Creating Objective-C Accessor Methods for a Managed Object

Quickly create prototypes for custom accessor methods for your managed object class using the Core Data model editor.

bullet
To create Objective-C accessor methods for a managed object
  1. In the project navigator, select the managed object model file that contains the entity for which you want to generate accessor methods.

  2. In the Core Data model editor, in the detail area, select the attributes or relationships for which you want to generate accessor methods.

  3. Choose Edit > Copy.

  4. In the project navigator, select the interface or implementation file into which you want to paste the code.

  5. Position the cursor in the source editor where you want to insert the accessor methods.

  6. Choose Edit > Paste <ItemType>.

    ../Art/createAccessors_2x.png

Xcode generates the appropriate declaration or implementation code dependent on the properties you copy and the source file you select.

The Paste <ItemType> menu item reflect the context, so that <ItemType> is one of the following:

  • Attribute Interfaces

  • Attribute Implementations

  • Relationship Interfaces

  • Relationship Implementations