I'm trying to make Core Data objects inherit from my own custom class rather than NSManagedObject. I started using Mogenerator and noticed that it has a --base-class
arugument which does exactly what I want.
The problem is that by default it doesn't use this parameter, and so every time I save my data model file, it sets the inherited class to NSManagedObject
. Is there any way to add this additional parameter to the script so that it works as I want it to every time I save the .xcdatamodel
file?
If not, is there any other way I can easily run this command from Xcode? I was thinking about creating it as a User Script. The problem is that I don't want it hardcoded to this project's files. This is an example of the command line I need to run:
mogenerator -m MyProject.xcdatamodeld/MyProject.xcdatamodel -O Classes --base-class MyManagedObject
Ideally, it should find the .xcdatamodel
file of the current project. As I have no experience in mac development, I would appreciate it if you could point me in the right direction and tell me which commands will be the most useful to me if do indeed make this script myself.