Database Reference
In-Depth Information
Chapter 3: The Core Data
Stack
By Pietro Rea
Until now, you've been relying on Xcode's Core Data template. There's nothing
wrong with getting help from Xcode (that's what it's there for!), but if you really
want to know how Core Data works, building your own stack is a must.
The stack is made up of four Core Data classes:
NSManagedObjectModel
NSPersistentStore
NSPersistentStoreCoordinator
NSManagedObjectContext
Of these four classes, you've only encountered NSManagedObjectContext so far in
this topic. But the other three were there behind the scenes the whole time,
supporting your managed context!
In this chapter, you'll learn the details of what these four classes do. Rather than
rely on the default starter template, you'll build your own Core Data stack: a
customizable “wrapper” around these classes that works as a unit.
Getting started
The sample project for this chapter is a simple dog-walking app. This application
lets you save the date and time of your dog walks in a simple table view. Use this
app regularly and your pooch (and his bladder) will love you.
You'll find the sample project Dog Walk in the resources that accompany this topic.
Open Dog Walk.xcodeproj to open the project in Xcode, and build and run the
starter project:
 
 
Search WWH ::




Custom Search