Performing the Fetch

Create a new fetched results controller for each query. Initialize it with the fetch request, the context, and the section name key path. You can always use @"section" and make sure to define a section attribute for the objects; often, the needs are not complex.

The controller also uses a cache name parameter. Caching reduces overhead associated with producing data that’s structured with sections and indexes. Multiple fetch requests are ignored when the data has not changed, minimizing the cost associated with fetch requests over the lifetime of an application. The name used for the cache is arbitrary. Either use nil to prevent caching or supply a name in the form of a string. This method uses nil to avoid errors related ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.