badmojo

out of focus
Jul 19
Permalink

Core Data & Categories

Here’s a small tip when working with Core Data. If you have some convenience methods or other behavior you’d like to add to your managed object, please do so by creating a category for your managed object class. This way you can regenerate your managed object classes without losing your precious methods.

Example:

The header file of the generated managed object class:

Managed Object

The category that extends the functionality of the managed object:

Category

take care,

phil.