In one of my apps, I use NSTableViewDiffableDataSource
in tandem with NSFetchedResultsController,
which provides the necessary snapshots. This works great in macOS 14.5.
However in latest macOS 15 betas, NSTableViewDiffableDataSource
does not call the 'cellProvider'
completion handler anymore when the data of a visible cell changes. When data of a visible cell changes, the didChangeContentWith
method of NSFetchedResultsController
is called correctly, but applying the provided snapshot doesn’t result in calling the said 'cellProvider'
completion handler. This looks a rollback to the early state of this API in 2020.
It concerns this piece of code:
dataSource = NSTableViewDiffableDataSource(tableView: tableView, cellProvider: { (tableView, tableColumn, row, item) -> NSView in
// Return a cell view with data
})
Does anyone know a solution or workaround to get animated updates of visible cells working in macOS 15 beta?
Yes, applying the snapshot without animation works, but that’s not where NSTableViewDiffableDataSource is designed for.
In case an Apple engineer reads this:
- Looking at the sample code associated with FB13931189, is there anything wrongly implemented that prevents calling the 'cellProvider' method for visible cells?
- Is this perhaps actually a bug of NSFetchedResultsController? I’m asking this because NSCollectionViewDiffableDataSource does have a very similar problem (FB13943853).
PS
Yes, this post looks very similar to https://developer.apple.com/forums/thread/759381#759381021, because the problem is identical except that concerns NSCollectionViewDiffableDataSource.