views:

2033

answers:

4

How to add new templates in Xcode for iPhone application developement?

+5  A: 

For some advices, I suggest to take a look at answers to a related question: Change templates in Xcode.

In particular, if you want your modifications not to be lost whenever you upgrade Xcode, put your templates in ~/Library/Developer/Shared/Xcode, not under /Developer.

mouviciel
+3  A: 

From my answer to this question:

XCode uses template files for file and project templates and does variable expansion in both at creation time.

XCode 3.0-3.1 templates can be found in [Dev Installation]/Library/Xcode/, likely /Developer/Library/XCode. If you want to modify these templates or add your own, use the following directories to save your new/modified templates so that they are not wiped out by future Developer Tool upgrades:

  • File templates: ~/Library/Developer/Shared/Xcode/File Templates/
  • Target templates: ~/Library/Developer/Shared/Xcode/Target Templates/
  • Project templates: ~/Library/Developer/Shared/Xcode/Project Templates/

I think that you can also use the /Library/Developer/Shared/Xcode/[File|Target|Project] Templates/ directory for templates shared by all users.

A good tutorial on writing file templates is here [MacResearch.org].

Barry Wark
A: 

If it helps, i've created a tutorial to demonstrate how you can change the existing project templates. The method i use prevents that the templates are overwritten upon installing a new version of Xcode. I've tested this method using Xcode version 3.2.2 and 3.2.3 (beta)

http://www.sodeso.nl/?p=895

ronaldmathies
A: 

I wrote an article on how to create a new Xcode template from an existing project here.

It covers:

  • specifying your project files are relative to the project path
  • using the commandline to search / replace & fiddle file permissions
  • excluding info.plist from the target membership
  • giving your template an icon

It doesn't cover where to put the template. That information is covered in other answers.

Ohmu