Creating an Entity and Its Properties
When you start a new project in Xcode and open the template selection dialog, select the Use Core Data checkbox. A source file for the Core Data model is created as part of the template. That source file will have the extension .xcdatamodeld. Select that file in the navigator area to display the Core Data model editor.
To create an entity
- Click Add Entity.
- A new untitled entity appears in the Entities list in the navigator area.
- Select the new untitled entity.
- In the Entity pane of the Data Model inspector, enter the name of the entity, and press Return.
To create attributes and relationships for the entity
- With the new entity selected, click the Add button (+) at the bottom of the appropriate section.
- A new untitled attribute or relationship (generically referred to as a property) is added in the Attributes or Relationships section of the editor area.
- Select the new untitled property.
- The property settings are displayed in the Relationship pane or Attribute pane of the Data Model inspector.
- Give the property a name, and press Return.
- The attribute or relationship information appears in the editor area.
Employee entity in the Xcode Data Model editor shows an entity called Employee, with attributes that describe the employee: date of birth, name, and start date.