Core Data is Apple’s framework for managing the model layer of an application. Apple’s own programming guide defines it directly: “Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence.” In practice it lets a developer work with ordinary objects and relationships in memory while the framework handles loading, saving, and keeping everything consistent.
The framework’s central job is object-graph management. It tracks the network of model objects and their relationships, propagates changes, maintains referential consistency, and supports undo and redo. Apple notes that this typically cuts the amount of model-layer code by 50 to 70 percent, because features like change tracking, validation, and lazy loading come built in rather than being hand-written for each app.
Persistence is layered on top of that graph. Core Data can save objects to and fetch them from a persistent store, and it supports several store types. For sizable data sets the usual choice is an SQLite store, which Apple recommends because it offers high performance and, unlike an in-memory or single-file store, does not require the entire object graph to be resident in memory at once. This pairing of an object-oriented modeling layer over an SQLite database is one of Core Data’s defining characteristics.
A key efficiency mechanism is faulting. A fault is a placeholder that stands in for a managed object or relationship that has not yet been loaded; it consumes little memory, and related objects are realized only when actually accessed. Combined with copy-on-write data sharing, faulting lets Core Data put boundaries on the object graph so an app can work with large data sets without pulling all of it into memory.
Core Data first shipped on Mac OS X v10.4 “Tiger” in 2005 and later came to iPhone OS, becoming a standard persistence option for iOS apps. It descends from Apple’s NeXT heritage, building on the data-modeling ideas of the earlier Enterprise Objects Framework, and it integrates with the Cocoa and Cocoa Touch frameworks and with Xcode, which provides a visual data-model editor for defining entities, attributes, and relationships.