O'Reilly logo

Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming by Erica Sadun, Rod Strougo, Maurice Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Part 2: Implementing NSFetchedResultsControllerDelegate

The code in this chapter works so far, but there is one potential problem. Each time the data in the managed object context is updated by an addition, a deletion, or a change, you send performFetch: to the fetch results controller. The call can result in far more work and time than simply updating only the changed data.

The fetched results controller has the ability to observe changes in the managed object context and call methods when those changes occur. All you need to do is support the NSFetchedResultsControllerDelegate protocol. You start by declaring support for the protocol:

1. Open CarTableViewController.h and add the following line of code just below the import of UIKit:

#import ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required