How would I change the initial templates created by XCode when creating a new Cocoa Class.
I am referring to the comments and class name created when using XCode's new class wizard.
How would I change the initial templates created by XCode when creating a new Cocoa Class.
I am referring to the comments and class name created when using XCode's new class wizard.
You wouldn't change the existing templates. In other words, don't modify anything under the /Developer
hierarchy (or wherever you installed your developer tools).
Instead, clone the templates you want to have customized variants of. Then change their names and the information in them. Finally, put them in the appropriate location in your account's Library/Application Support
folder, specifically:
~/Library/Application Support/Developer/Shared/Xcode/File Templates/
~/Library/Application Support/Developer/Shared/Xcode/Target Templates/
~/Library/Application Support/Developer/Shared/Xcode/Project Templates/
That way they won't be overwritten when you install new developer tools, and you can tweak them to your heart's content.
XCode uses template files for file and project templates and does variable expansion in both at creation time.
XCode 3.0 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:
I think that you can also use the /Library/Developer/Shared/Xcode/[File|Target|Project] Templates/ directory for templates shared by all users.
If you just want to change the MyCompanyName in the templates, the following command line will do the trick:
defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ "ORGANIZATIONNAME" = "NewCompanyName";}'
A good tutorial on writing file templates is here [MacResearch.org].