Adding the MasterProduct entity to the Data Model
We need an extra entity to store the information of different products that a vendor is supposed to sell through this application. The information of master product includes product name, price, quantity in hand, and product image, so the entity that we are going to create will consist of four attributes: itemname, price, quantity, and image. The steps for adding the MasterProduct entity are as follows:
1. Let us open the Xcode's Data Modeling tool by double-clicking the prob.xcdatamodel file from the Resources group in Xcode Project window.
2. To add a new entity to our data model, select the + (plus) button at the bottom of the Entity pane or choose Design | Data Model | Add Entity from the menu bar. A blank entity (by default name: Entity) will be added to our data model, which we will rename to
MasterProduct
. Automatically, a subclass of NSManagedObject will be created for our MasterProduct entity.3. To add attributes to our MasterProduct...