Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Swift enhancements #212

mrichtsfeld opened this Issue · 6 comments

2 participants



First of all, great project!

Since Swift will be the new state of the art for coding cocoa(touch) I'm diving into it, writing my new project already with Swift. I use mogenerator since I use CoreData and was always happy with it.

Now I try using it with Swift and stumbled over some issues. Of course I know that this is still pre-release, but I want to help making it better so I have a few questions. Depending on the outcome I will also implement the changes and contribute them to the project.

So here are my issues:

I don't get the namespace prefix used when creating swift classes e.g.

class MyPrefix.MyClass: NSManagedObject {    

This gives me an error so it does not seem to work currently.

Furthermore I'm not sure why the Attributes for all classes are enums because then it is always necessary to add a toRaw()to get the actual value. Wouldn't it be better to use a struct instead like:

struct MyClassAttributes {  
    static let myAttribute: String = "myAttribute"  

Please tell me what you think so I can implement whatever is necessary.


I just found out where the strange MyPrefix. is coming from. In Swift it is necessary to add the Module name when setting a class name in the data model. This Module name is then also added to the classes which does not make sense, so I would simply kick out the module name and only use the class name.


I agree about the use of enums versus structs. Also, they should live inside the entity subclass, which will automatically namespace them to the class. PR?


I've just proposed PR #221.


Great, I also changed it exactly the same way for my tests, but didn't send a pull request yet. Thanks for doing that. This way it is a lot easier to use.
Did you also stumble over the "MyModule." issue? I will create a pull request for this asap.


I did, yes.


And #222 is up for the MyModule. issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.