Database Reference
In-Depth Information
As you can see, the sample app is already a fully-working (albeit simple) prototype.
Tapping on the plus (+) button on the top-right adds a new entry to the list of
walks. The image represents the dog you're currently walking, but otherwise does
nothing.
The app has all the functionality it needs, except for one important feature: The list
of walks doesn't persist. If you terminate Dog Walk and re-launch, your entire
history is gone. How will you remember if you walked your pooch this morning?
Your task in this chapter is to save the list of walks in Core Data. If that sounds like
something you've already done in chapters 1 and 2, here's the twist: you'll be
writing your own Core Data stack to really understand what's really going on under
the hood!
Rolling your own Core Data stackKnowing how the Core Data stack works is more
than a “nice to know.” If you're working with a more advanced setup, such as
syncing with iCloud or migrating data from an old persistent store, digging into the
stack is essential.
Before you jump into the code, let's consider what each of the four classes in the
Core Data stack— NSManagedObjectModel , NSPersistentStore ,
NSPersistentStoreCoordinator and NSManagedObjectContext —does in detail.
Note: This is one of the few parts of the topic where you'll read about the
theory before using the concepts in practice. It's almost impossible to separate
one component from the rest of the stack and use it in isolation.
 
Search WWH ::




Custom Search