Learn swift on the mac

Page 186

CHAPTER 20: Working with Core Data

189

Figure 20-3.  CoreData Entities Editor

There’s a default entity called Event that you don’t really need, so delete it. Now let’s create the Car entity and add some attributes to it. Select the Add Entity button on the bottom of the editor. A new entity named Entity will be added to the entity list. Rename that to Car and add the attributes listed in Table 20-1. Table 20-1.  Attributes to be added to new entity

Attribute Name

Attribute Type

make

String

model

String

year

Date

color

String

doors

Integer 16

Under the Attributes section, select the + button to add new attributes. After adding each attribute, set its name and the type. You select the type by choosing from the pop-up menu (Figure 20-4).


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.