I am using a NSSearchField on top of a NSTableView to filter it contents. Basically it works fine, but the whole window flickers / flashes when .reloadData is called
Image: https://i.stack.imgur.com/dtJ9Z.gif
My search function is pretty straight forward:
@IBAction func sideBarSearchFieldAction(_ sender: Any) {
DispatchQueue.main.async {
let searchString = self.sideBarSearchField.stringValue
if searchString == "" {
myArrayBuffer = myArray
} else {
let filteredArray = myArray.filter { $0.searchString.contains(searchString.lowercased()) }
// 'myArray' is a collection of struct’s with a var 'searchString'
myArrayBuffer = filteredArray
// 'myArrayBuffer' is displayed by the NSTableView
}
self.sideBarTableView.reloadData()
}
}
Would be great if someone could help!