In our Data Model, we have to establish relationships in two directions: one in the forward direction from the Customer to the Product entity and the other in the backward direction from the Product to the Customer entity.
As a customer can purchase several products, the relationship from the Customer entity to the Product entity will be of the one to many type. To add the relationship, follow the given steps:
1. Select the Customer entity (in the Xcode's data model editor) in the Entity pane and from the Attributes pane select the + (plus button) to add an attribute (the relationship is stored in the form of an attribute in the Data Model).
2. From the menu that pops up, select the Add Relationship option. Specify the name of the relationship as
product
.3. From the Destination drop-down list, select the Product entity (to declare that the relationship...