Database Reference
In-Depth Information
Chapter 2: NSManagedObject
Subclasses
By Pietro Rea
You got your feet wet with a simple Core Data app in chapter 1; now it's time to
explore more of what Core Data has to offer!
At the core of this chapter is subclassing NSManagedObject to make your own classes
for each entity. This creates a direct one-to-one mapping between entities in the
data model editor and classes in your code. It means in some parts of your code,
you can work with objects and properties without worrying too much about the
Core Data side of things.
Along the way, you'll learn about all the data types available in Core Data entities,
including a couple that are outside the usual string and number types. And with all
the data type options available, you'll also learn about validating data to
automatically check values before saving.
Getting started
Head over to the files that accompany this topic and open the sample project
named Bow Ties . Like HitList, this project uses Xcode's Core Data-enabled Single
View Application template. And like before, this means Xcode generated its own
ready-to-use Core Data stack located in AppDelegate.swift .
Go to Main.storyboard . Here you'll find the sample project's single-page UI:
 
 
Search WWH ::




Custom Search