In short, how is NSFetchedResultsController used?
I've been reading now from one hour through the documentation and still don't get the point NSFetchedResultsController
. Is this a replacement for UITableViewController
? Or is it used UITableViewController
with NSFetchedResultsController
? Is it NSFetchedResultsController
a data source? What is it?
source to share
NSFetchedResultsController
brings together all the Core Data related functionality required to perform when providing data for a table. It encapsulates a lot of common table-related functionality so you don't need to manually manage them. It serves as the programming interface between the table controller and the underlying data model.
To view the tables, you need the data presented in a 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
Help all this:
- In addition to all the ordering and sorting done with sets, it fetches and manages sections automatically, so you don't have to do a separate selection just for the sections.
- It caches the retrieval results, which speeds up the display of the table.
- It monitors the master data graph and notifies its delegate, usually the table controller, if the table needs to reload its data. This is very useful in situations like loading data from a URL. If the data is constantly changing, you should be constantly fetching and checking the results if you are not using
NSFetchedResultsController
.
You don't have to use it. You can do it all manually if you like. If you are not using Core Data in your data model, then you are not using it.
source to share