Update:Nov 7th 2011:
Get the latest ARC compatible template from the Attachments section
With XCode 4, Apple has made some changes to the template subsystem as such none of the old templates that worked on XCode 3 will work automatically. After spending a couple of hours, I managed to figure out the differences and fortunately, the new template subsystem is more cleaner than XCode 3. The Singleton template I created last year is now migrated to support XCode 4.
XCode 3 vs XCode 4 Template Changes
Some good news here. Back in the ages of XCode 3, you have to manually edit a plist when you install multiple templates from different sources. For example, if you install the NSOperationTemplate by Jeff Lamarche and then install the Singleton template by me, you will end up overwriting the template list plist and at anytime only the lastly installed template will be shown on the XCode New File dialog. With XCode 4, Apple has made some changes that, every template is independent and doesn’t really have to overwrite any files that was installed with XCode. This means, when you install multiple templates or when you do upgrades, you don’t have to manually edit any files or re-install templates.
Download these files from the attachments section and extract them from Terminal using the command
The new Xcode 4.3 gets installed into /Applications by default and you have to overwrite the contents of the package file which requires admin privileges. So you should type in your password after entering this command.
sudo unzip SingletonTemplateARC.zip -d /Applications/Xcode.app/Contents/ sudo unzip NSOperationTemplate.zip -d /Applications/Xcode.app/Contents/
If you are still on Xcode 4.2 (I don’t understand why anyone would be using that though), enter the following commands instead.
unzip SingletonTemplateARC.zip -d / unzip NSOperation.zip -d /
Once it’s extracted, open XCode 4 and add a new file to your project. The new file dialog will now show two new icons as shown below.
Update:Nov 7th 2011:
Singleton Template for XCode 4 (ARC Compatible)
As a bonus, I’ve also migrated Jeff Lamarche’s NSOperation template to XCode 4. I believe his code is in public domain and free for derivate work and re-distribution. So get it for XCode 4 here.
NSOperation Subclass Template for XCode 4
Leave a comment or tweet this if you like.
Follow me on Twitter