iOS Discovery Log - Mogenerator and Core Data

In last night's Professional iOS Development class, we were introduced to mogenerator and was asked to complete an in-class exercise on getting mogenerator to work.

Right away, the first thing that came to my mind was, what is mogenerator?  After a few searches and readings, here's my explanation for what mogenerator is: 

  • Mogenerator is a command-line tool that generates two classes per entity in Core Data, one that is used by machine (similar to what Apple has always been doing) and one that is used by humans (us of course, I think).

And now, the next question, how do I use it with my projects?  Well, first we have to download it.  To download mogenerator, the file can be found at http://rentzsch.github.io/mogenerator/.

After downloading and installing mogenerator, I searched for tutorials that would show how to configure mogenerator to work in Xcode.  Found an excellent tutorial at http://raptureinvenice.com/getting-started-with-mogenerator/ but I ran into one problem though, the tutorial was written for Xcode 4, not Xcode 5, so some of the directions ended up with me scratching my head for a bit trying to figure things out.  I stumbled upon http://www.runscriptbuildphase.com/ which shows you how to add a run build script phase for Xcode 5, but the website also lets you switch to different versions of Xcode too!

After configuring mogenerator to work in Xcode, everything worked like a charm!  It felt easier and less time consuming now when generating model classes for Core Data entities.  

I'll create a tutorial and update this post accordingly in the next couple of days too!

Update 12/05/2013 - Tutorial up at this blog post.