Building a Model File

Create your model in Xcode by laying out a new data model file. Some iOS templates allow you to include Core Data as part of the project. Otherwise, you create these Xcode model files by selecting File > New > File from the Xcode menu and then choosing iOS, Core Data, Data Model, and Next. Enter a name for your new file (this example uses Person), check the targets for your project, and click Save. Xcode creates and then adds the new model file to your project (for example, Person.xcdatamodeld). Click the xcdatamodeld file in the File Navigator to open it in the editor window shown in Figure 12-1.

Image

Figure 12-1 Xcode’s editor ...

Get The Core iOS Developer’s Cookbook, Fifth Edition 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.