I have an NSTableView that periodically stops animating and updating itself correctly, which leads to a terrible user experience.
let oldRows = filteredDocuments let newRows = newFilteredDocuments let diff = oldRows.diff(newRows) filteredDocuments = newFilteredDocuments if (diff.results.count > 0) { let deletionIndexPaths = NSMutableIndexSet() diff.deletions.forEach { deletionIndexPaths.addIndex($0.idx) } let insertionIndexPaths = NSMutableIndexSet() diff.insertions.forEach { insertionIndexPaths.addIndex($0.idx) } self.tableView?.beginUpdates() self.tableView?.removeRowsAtIndexes(deletionIndexPaths, withAnimation: NSTableViewAnimationOptions.EffectFade) self.tableView?.insertRowsAtIndexes(insertionIndexPaths, withAnimation: NSTableViewAnimationOptions.SlideLeft) self.tableView?.endUpdates() }
There seems to be no logic when he stops the animation, and in many of the tests that I have done, he almost feels as if it is related to the construction. Interestingly, it never stops animating when I profile ...
It is as if something in the main thread is clogging the user interface, and then NSTableView expires and cancels the update, but I have no idea how to debug this.
swift appkit nstableview macos
Chris
source share