Post

Replies

Boosts

Views

Activity

Reply to Updates with UITableViewDiffableDataSource and NSFetchedResultsController?
I am probably a year late. I recently run into similar issue where, when attributes of a managed object changes, the view is not updated. FRC's delegate method is called: func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) The snapshot object contains the identifier (MOID) to the changed object as well! In order to get my table cell refreshed, I use the implementation similar to the one discussed in "How-to use Diffable Data Sources with Core Data" by SwiftLee. Look for the sample implementation of the delegate method there. The gist is... for object with attributes updated, add them to the snapshot by calling snapshot.reloadItems(_:)
Nov ’20
Reply to Updates with UITableViewDiffableDataSource and NSFetchedResultsController?
I recently run into row update issue discussed here. When managed object attribute is updated, the change, initially, does not propagate to the view. The blog post on SwiftLee "How-to use Diffable Data Sources with Core Data" shows how to solve the issue. Look for sample code calling this method snapshot.reloadItems(reloadIdentifiers) For managed objects with attributes changed, you should add the managed object identifier by calling reloadItems method.
Nov ’20