Building Object Classes

After creating your entity definition, save your changes to the data model file. Select an entity in the column on the left and from the Xcode menu, choose Editor > Create NSManagedObject Subclass. Select your data model and the entity (or entities) you intend to manage. Save to your project folder, select the group you want to add the classes to, and click Create. Xcode generates class files from your entity description. Here is what the automatically generated Person class looks like:

@interface Person : NSManagedObject @property (nonatomic, strong) NSString *section; @property (nonatomic, strong) NSString *emailaddress; @property (nonatomic, strong) NSString *gender; @property (nonatomic, ...

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.