Persistent Object Coordinator

A persistent store coordinator includes the persistent object stores and a managed object model and presents a facade to managed object contexts such that a group of persistent stores appears as a single aggregate store.

It is the object of NSPersistentStoreCoordinator. It contins the reference to a NSManagedObjectModel object which defines the entities in the store. it is the central object in the Core Data stack.

In many applications, we have a single store, but in complex applications, there may be several, each potentially containing different entities. The persistent store coordinator's role is to manage these stores and present to its managed object contexts the facade of a single unified store. When we fetch records, Core Data retrieves results from all of them unless you specify which store we interested in.

Each persistent store contains its characteristics, I.e., it can be read-only, stored as binary or SQLite or in-memory, or our implementation of an NSIncrementalStore. It is possible to store different parts of our model in different persistent stores to take advantage of this flexibility.

Persistent Object Coordinator




Latest Courses