Using Predicates

Predicates can be used to narrow down your fetch results to data that match your specific criteria. They are analogous to a where clause in an SQL statement, but they can be used to filter elements from a collection (like an NSArray) as well as a fetch request from Core Data. To see how a predicate is applied to a fetch request, refer to method fetchedResultsController in ICFSharedMoviesViewController. This method lazy loads and sets up an NSFetchedResultsController, which helps a table view interact with the results of a fetch request (this is described in detail in the next section). Setting up a predicate is simple, for example:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"lent ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK 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.