DELEGATE: NSFetchedResultsController

You can tell by looking in its header file that CoreDataTVC adopts the NSFetchedResultsControllerDelegate protocol, which means optional methods can now be implemented to ensure the Table View Controller correctly handles moves, deletes, updates, and insertions. Whenever you need to make a change to a table view, you need to tell it to beginUpdates, and when you’re done, endUpdates. When you’re using a fetched results controller, you need to call these methods from controllerWillChangeContent and controllerDidChangeContent, respectively, as shown in Listing 5.4.

Listing 5.4 CoreDataTVC.m Content Changes

#pragma mark - DELEGATE: NSFetchedResultsController- (void)controllerWillChangeContent:(NSFetchedResultsController ...

Get Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.