Xcode 3.1

I finally got around to updating Xcode to 3.1 yesterday.

There’s some great stuff in there. At last, the autocomplete of method names puts in tokens for the arguments, so you can just click on the token and then overtype - or just delete it in one go with (forward) delete.

Another cool thing is something that I’ve seen in NetBeans, but the default settings there for it are just annoying. Previous instances of the currently selected variable are highlighted. In Xcode it is a much subtler underline, much better than bright yellow.

This is better than NetBeans in another way - you can click on the item, and access a special contextual menu that allows you to edit every instance of the variable name in your current scope. Thus, refactoring is made much easier.

I’m sure there was something else I really liked too, but I can’t recall what it was.

Using moGenerator as part of the Build Process (XCode)

Using Core Data is awesome.

moGenerator makes it even better, as you can have Entitites defined as being of a particular class, and this code generator creates two classes for each Entity - a machine-readable one which is updatable by running the script again, and a human readable one that you can safely edit - it won’t be changed once it has been created.

You can easily make this tool a part of you build process.

First, create a new directory inside your project folder, I called mine MO. Then, cd to that directory, and run:

$ mogenerator -m ../*_DataModel.xcdatamodel

Then add the folder MO to your project.

Now add a new build phase script, and put into it:

cd MO
mogenerator -m ../*_DataModel.xcdatamodel

It’s not quite perfect - if you add a class, it won’t be added to your project automatically. You might be able to get around this by including the -includem switch, but then you won’t be able to have the .m files located in your project, else you will get duplicate symbol errors.