Being fairly new to CoreData (Started playing with it 2 hours ago ;) ) I keep wondering if there is an easier way to do things.
I'm currently using a DataModel to create my persistant objects code.
However when I keep adjusting things like number of attributes sotred, the name of the fields etc... and that leads to having the update the code of my NSManagedObjects.
I found that you can create the classes with the attributes already implemented, however, I haven't figured out how to update the code of an existing class other than adding it by hand or creating a new object and overwriting the existing one? (or how do other developers do it)
I'm aware that the answer is surely: "there is no better way" but I still have to ask.
Check out mogenerator.
This command line utility will generate two class files. A machine generated _MyClass
header and implementation, with all code for your model. It will also create a subclass MyClass
where you can add your own customizations.
Each time you regenerate your code, only the machine generated _MyClass
files will be updated. All your changes to MyClass
will be preserved.