Creating Contexts

In Core Data, entities provide descriptions. Objects are actual class instances that you create from entity specifications. These instances all descend from the NSManagedObject class and represent entries in the database.

Core Data objects live within a managed object context. These contexts, which are instances of NSManagedObjectContext, each represent an object space within your application. This chapter uses a single object context, although more complex implementations may be required in your own apps, primarily to support multithreaded Core Data access.

In this single-object-context example, you establish your context as you start up your application and use that context for all object fetch requests from the stored data. ...

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.