Reputation: 2994
I'm learning about NSFetchedResultsController
and one thing puzzles me. The NSFetchedResultsController
is used in combination with UITableView
to help with fetching performance and to calculate which records to fetch based on what is currently shown in the UITableView
.
When you use a UITableView
index (like the first letters in the Addressbook app) doesn't that mean the whole dataset will be loaded to determine all the first letters of all the sections?
Doesn't the use of the index prevent the NSFetchedResultsController
from being smart about what it loads?
Upvotes: 0
Views: 246
Reputation: 18363
NSFetchedResultsController
builds its index from the sectionKeyPath
. One would assume that to get the values for this, a fetch would be performed to only get unique values for this key and not anything close to the full data set. For example, it could be doing something like making an NSFetchRequest
with a result type of NSDictionaryResultType
, returnsDistinctResults
set to YES
, and propertiesToFetch
set only to sectionKeyPath
.
Upvotes: 1