The Core Data Environment

Core Data is able to hide the mechanics of persistence so that app code is able to work directly with model objects with no worries about how they are stored or saved. To do this, Core Data utilizes four major classes to define the environment: NSManagedObjectModel, NSPersistentStoreCoordinator, NSPersistentStore, and NSManagedObjectContext. When a Core Data–enabled project is set up in Xcode, the template provides logic to set up instances of these four classes. Adding Core Data to a new project is a fairly quick exercise, because all that is needed is to set up a managed object model, do any customizations needed to the rest of the environment, and begin writing app logic to use it.

The pattern that the Core Data ...

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.