Updating Items
With the persistent container set up, you can now interact with Core Data. Primarily, you will do this through its viewContext. This is how you will both create new entities and save changes.
The viewContext is an instance of NSManagedObjectContext. This is the portal through which you interact with your entities. You can think of the managed object context as an intelligent scratch pad. When you ask the context to fetch some entities, the context will work with its persistent store to bring temporary copies of the entities and object graph into memory. Unless you ask the context to save its changes, the persisted data remains the same.
Inserting into the context
When an entity is created, it should be inserted ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access