Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Code Generation
For each entity in the model, you specify a class that will be used to represent it in your application. By default, the class is set to NSManagedObject
, which is able to represent any entity. Typically, at the beginning of a project, you use NSManagedObject
for all your entities. Later, as your project matures, you define custom subclasses of NSManagedObject
to provide custom functionality.
You can use the New File Assistant to create a default implementation of a managed object class. First, select an entity or a collection of entities in the model, then choose File > New File. In the file type outline view select Design > Managed Object Class and press Next. (If you have not selected any entities, you do not see the entry for Managed Object Class.) In the subsequent pane select the appropriate project and targets, then again press Next. In the following pane (see Figure 1), select the entities for which you want Xcode to generate default class implementations. Check the relevant boxes to specify whether or not the implementations should contain custom accessor, validation methods, or Objective-C properties (see Declared Properties). When you press Finish, Xcode creates the files you specified.
Copyright © 2010 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2010-09-02