Adding the CDCar Model

Next, you need to create the file that Core Data uses to set up entities and other configurations. The same description file and editor can be used for anything from a simple single-entity configuration like CarValet to very complex models including multiple entities, entity properties, default values, and relationships.

Adding the car model takes just a few steps:

1. Add a new file to the project by using the Data Model template from the Core Data category. Call the file CarValet and add it just above Car.h.

2. Open the new CarValet.xdatamodeld if it is not already there. You should see an editor similar to the one in Figure 9-3.

Figure 9-3 Core Data editor

3. Add an entity called CDCar by clicking the Add Entity button ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.