Xcode project and file templates

I’ve known about Xcode project templates for quite a while. I even wrote a little script once that would take an Xcode project and convert it into a template. All you had to do then was copy it to a magical place in your home directory and you had custom Xcode projects.

Unfortunately, there was no way to setup file templates. If you went to Xcode File -> New File, you would get the Xcode default files.

As of Xcode 3.1.2, there are improvements. You can now specify both project and file templates. Go to /Library/Application Support/Developer/Shared/Xcode. You can create Project Templates and a File Templates directories. Copy your favorite default set from /Developer/Library/Xcode/ and edit the files. Now, just like in New Project, there will be a set of User Templates in the New File dialog box in Xcode. Of course, none of this is documented.

Don’t forget to store your templates somewhere in your home directory and use symbolic links in the system directory. That will help with upgrading.

Thanks to the MacFUSE project for tipping me off.