Kalaivani
Kalaivani

Reputation: 424

What are some benefits of using NSFetchedResultsController other than loading subset of rows

We use NSFetchedResultsController for loading only sub set of rows rather than full data in the Table. Are there any unknown benefits of using it? Thanks.

Upvotes: 0

Views: 507

Answers (1)

Eimantas
Eimantas

Reputation: 49354

You can fetch subset of rows using NSPredicate. So it's not really an advantage of FRC over plain NSFetchRequest with set predicate.

One of the biggest advantages is that a FRC can monitor storage changes for you and notify your provided delegate of said changes. Whether the data set has an entry added, removed or updated. See NSFetchedResultsControllerDelegate protocol reference.

It also has built-in caching mechanism. Although I haven't seen in my iOS-devs career people using it.

And last one that I can think of is that you are able to provide section's key path and you get "sectioned" data out of the box. With plain NSFetchRequest you'd have to section-ize data yourself.

Upvotes: 3

Related Questions