Re: Extending Xcode...
Re: Extending Xcode...
- Subject: Re: Extending Xcode...
- From: James Bucanek <email@hidden>
- Date: Fri, 9 Jun 2006 10:14:50 -0700
Nick Lott wrote on Saturday, June 10, 2006:
>
>I'm currently using Xcode to develop for AVR micro-controllers. I
>have built a few simple templates to make my life a little easier.
>Is there an online resource or any documentation for adding custom
>built templates for files, projects and targets?
>
>I have searched through the documentation and have been unable to
>turn up anything other than basically how to use the pre packaged ones.
The can be done, but the format is not publicly documented.
The basic process is this: Project, target, and file templates are stored in the Library/Application Support/Apple/Developer Tools/File|Project|Target Templates folder. You can modify the ones in /Library/... or append your own by placing them in a local ~/Library/Application Support/Apple/Developer Tools/ folder.
Templates are organized into groups via subfolders. This is how the template assistants create their categories for new projects/targets/files.
Single file templates are the easiest to create. Just put a file in the template folder and it will appear in the new file assistant.
Ditto for dumb project templates. Create a project, close it, clean it out (delete its build folder, etc.), then move it to where you want it in the Project Templates folder.
Target templates are just .plist files that describe a target type. The format and contents are undocumented, and it is *really* easy to create a target template that's invalid and will kill Xcode. The safest thing I've found is to copy a target template plist that is as close to the type you want to create and edit the details, without making any big structural changes.
Using any of these techniques will product a file, project, or template that is an exact duplicate of the template you added.
If you want to do more complex things with templates you need to investigate template macros. Project, target, and file templates can all contain macros that can automatically customize the final product. File template packages can be written that will create pairs of matched files (.h & .m, for instance) at the same time. Project templates can even rename files (e.g. renaming the main class file to match the primary class of your application). Unfortunately, these things start to get really complicated. I cover all of this in my book, but it's a good 10 pages of details. Write again if you have specific questions.
James Bucanek
____________________________________________________________________
Author of Beginning Xcode ISBN: 047175479X
<http://www.beginningxcode.com/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden