I create a simple list, there are two kind of item: conversation and message, if click a conversation, it will expand it's messages. So there will be some insert and remove updates. I calculate the difference results and perform the batch update.
displayItems = newDisplayItems
tableView.beginUpdates()
tableView.removeRows(at: IndexSet(removeIndex), withAnimation: [.effectFade, .slideUp])
tableView.insertRows(at: IndexSet(insertIndex), withAnimation: [.effectFade, .slideDown])
tableView.endUpdates()
In most cases, the animation looks fine, but when the mock data is large (> 1000?) and called scrollRowToVisible to scroll to the last row in viewDidAppear, then click some conversations above, the UI broken.
Is there something wrong? Would appreciate help from someone experienced with NSTableView.