alionthego alionthego -4 years ago 97
iOS Question

Custom methods for CoreData classes

I'm trying to conform to the

MVC paradigm
in my iOS app. My model consists of entities stored in coreData which I have set up using the
xcdatamodel
file.

I want to add some custom methods to these entities in order to keep the Model part separate from the Controller.

In previous versions of Xcode the autogenerated
managedObject
classes were added automatically to my project and I could add custom methods to these classes. Now I no longer see these auto genterated classes.

I have selected 'Class Definition' for the codegen.

Do I need to create an additional class for each entity to enable custom methods on those
entities
? Or is there a better way to go about this.

Answer Source

This is a rather new Xcode feature. Xcode generates the files for you and holds a reference to the generated files. Even the files do not show up in the project, you still can write extensions for the generated classes.

You can find more detailed information in this answer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download