rentzsch.com: tales from the red shed

mogenerator v1.10

Code

mogenerator is my little command-line tool that reads in .xcdatamodel Core Data model files and spits out Objective C code following the Generation Gap codegen pattern.

Version 1.10 (download, source) is out — here’s what’s changed since the last time I wrote about it:

  • Corrected generated code that got snagged on the messaging-nil-with-method-returning-float gotcha (thanks to Ruotger Skupin).

  • Adds +[newInManagedObjectContext:] method to machine files. I can’t live without this method and it’s pretty much swiped from CoreData+JRExtensions so I don’t have to include those extensions for every Core Data project.

  • Now supports ObjC2 property syntax (but retains 10.4 compatibility thanks to preprocessor magic).

  • mogenerator now support 10.5 Core Data transformable attributes (thanks again Ruotger Skupin). It uses NSObject generically, but you can specify a different class name in the attributes user info under a attributeValueClassName key.

  • Plays a better game of hide-and-seek with Xcode’s installer and where it’s decided to locate momc this week. Handles Xcode 2.4, 3.0 and 3.1. Sadly, mogenerator still assumes /Developer — perhaps one day the installer will be enhanced to ask you which Xcode base to use. Patches welcome.

  • For those of you using Core Data in a multithreaded environment, 1.10 now generates a per-entity subclass of NSManagedObjectID. For example, if you had an entity named Person, its class name will be PersonMO and its managed object ID class name will be PersonMOID. Previously, you had to pass around type-less NSManagedObjectID when you wanted to handoff a managed object reference from one thread to another. Now you can pass a reference whose type will give you a clue as to what’s going on.

Tuesday, May 20, 2008
02:17 PM