Search code examples
xcodemacostemplatesxcode4xcode4.5

Change templates in Xcode


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.


Solution

  • 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:

    • File templates: ~/Library/Application Support/Developer/Shared/Xcode/File Templates/
    • Target templates: ~/Library/Application Support/Developer/Shared/Xcode/Target Templates/
    • Project 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.

    Update For newer versions of Xcode the updated path will be: ~/Library/Developer/Xcode/Templates/File Templates/Source