In Xcode 3, we worked out (by trial and error) that we could COPY the system templates to a new location (three possible locations, because Apple kept changing it), and customize them.
NB: while writing this question, I discovered most of the answers on StackOverflow on this topic are incorrect :(. Apple changed the locations, most answers give the old locations, which don't work any more.
At Xcode 4.3, Apple broke it all again, and now FILE TEMPLATES CANNOT BE CHANGED by the old method. From trial and error, I've found that you can create NEW file templates (see below), but the existing ones from Apple cannot be replaced.
How do we fix this? Apple's New File templates are simply appalling - they insert fake "copyright" lines, and they don't even follow Apple's own documentation standard, let alone anyone else's :(.
This is only a partial answer to the question, but for anyone else struggling (like me) to work out the "correct" way, here's a workaround that partially works.
Today, with Xcode 4.5.0, the following works:
Customize file/project templates:
- Un-hide your Library folder (google if you don't know how, or else do this from Terminal)
- Create a folder:
~/Library/Developer/Xcode/Templates
(the parent folder should already exist - Xcode4 auto-creates it)
- Find your copy of Xcode 4, and right click "Show Package Contents"
- Navigate in there until you find the "Templates" sub folder
- There are two folders, one for Mac, the other for iPhone
- Mac location:
[Xcode4.app]/Contents/Developer/Library/Xcode/Templates
- iPhone location:
[Xcode4.app]/Contents/Developer/Platforms/iPhoneOS.Platform/Developer/Library/Xcode/Templates
- Copy/paste the contents into the "Templates" folder you created
- CRITICAL: RENAME EVERY SUB-FOLDER OF "File Templates" OR ELSE APPLE WILL IGNORE/REMOVE YOUR TEMPLATES
NB: in step 2 above, you can also ALLEGEDLY create that folder at:
~/Library/Application Support/Shared/Xcode/Templates
...but that never works for me, and the parent folder doesn't exist with new installs of Xcode 4.5, so I suspect Apple is phasing this out? (since they refuse to document it, I'm just guessing)
It seems project templates can be in ~/Library/Developer/Xcode/Templates/Application/Project Templates
.
source: https://github.com/AFNetworking/Xcode-Project-Templates