blog.lukhnos.org

Customizing Xcode Templates

Apple supplies several project and file templates in Xcode. Those are styled understandably in the coding guidlines used by Apple internally.

My company follows a different set of guidelines, though. We use http://webkit.org/coding/coding-style.html with some modifications. So it became a pain when we had to create files, the number of which easily exceeds 50 in any iPhone/Cocoa project of ours, and had to modify them one by one to retrofit them into our own style.

Solution: Customizng our own Xcode templates.

Not well-documented, though, is that Xcode looks into your ~/Library/Application Support/Developer/Shared/Xcode. In particular, two directories not created for you are of interest: "Project Templates" and "File Templates".

After you have created those directories, you can copy into them the files from Apple's own template directories:

/Developer/Library/Xcode  # for Cocoa
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/  # for Cocoa Touch

Then start modifying the files according to your own taste.

I can assure you that I was told by an Apple engineer at a WWDC lab that some of them hated the directory structure of Xcode as much as I do, but it's probably too late for them to sanitize (in the sense of making them "sane" again) the mess.