In short, how is NSFetchedResultsController used?

I'm reading now since one hour through the documentation and still don't get the point of NSFetchedResultsController. Is it a replacement for UITableViewController? Or is the UITableViewController using the NSFetchedResultsController? Is the NSFetchedResultsController the data source? What is it?


NSFetchedResultsController bundles together all the Core Data fetch related functions you need to perform when providing data for a table. It encapsulates a lot of the common functions associated with tables so you don't have to manage them by hand. It serves as the software interface between a tableview controller and a Core Data based data-model.

Tableviews need data provided in structured list. They need to manage and display a lot of data. They need to update their displays when the data itself changes behind the scenes. NSFetchedResultsController assist all this by:

  1. In addition to all the ordering and sorting done by fetches, it fetches and manages sections automatically so you don't have to perform a separate fetch just for sections.
  2. It caches fetch results making the display of the table faster.
  3. It monitors the Core Data graph and notifies its delegate, usually the tableview controller, if the table needs to reload its data. This is very useful in situations such as loading data from a URL. If the data is constantly changing you have to constantly fetch and check the results if you don't use NSFetchedResultsController.

You don't have to use it. You can do all this by hand if you want to. If you do not use Core Data in your data-model, then you don't use it.

Need Your Help

Compiler Error variable "Not captured" inside lambda function for threadpool

c++ multithreading lambda scope

I'm learning about multithreading in c++ and am trying to set up a thread pool, but am getting a complier error saying "error: ‘mapperNodes’ is not captured" and "error: ‘command’ is not captured"....

How to add a full-sized image to the center of a webpage using jQuery?

jquery html css image

The way I have my site setup is that I have a grid of thumbnails that is sized based on the user's screen resolution and also has a scrolling mechanism in it. Another feature I'm trying to add is ...