mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
24 lines
552 B
Swift
24 lines
552 B
Swift
//
|
|
// NSTableView+Reload.swift
|
|
// ClashX
|
|
//
|
|
// Created by yicheng on 2019/7/28.
|
|
// Copyright © 2019 west2online. All rights reserved.
|
|
//
|
|
|
|
import Cocoa
|
|
|
|
extension NSTableView {
|
|
func reloadDataKeepingSelection() {
|
|
let selectedRowIndexes = selectedRowIndexes
|
|
reloadData()
|
|
var indexs = IndexSet()
|
|
for index in selectedRowIndexes {
|
|
if index >= 0 && index <= numberOfRows {
|
|
indexs.insert(index)
|
|
}
|
|
}
|
|
selectRowIndexes(indexs, byExtendingSelection: false)
|
|
}
|
|
}
|