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.
All the Xcode default template files are located at /Applications/Xcode. app/Contents/Developer/Library/Xcode/Templates/File Templates and grouped into sections by folder name. We can use Terminal or Finder to go directly to this folder. With Finder we can use the Go Menu, then Go to folder option.
However if Xcode is already open, you need to quit and restart to enable your changes. Then, go to File ▸ New ▸ Project… to open the New Project dialog. Scroll to the bottom of the iOS category. Here, you'll find a new Templates section that holds your custom templates.
System Preferences --> Users & Groups --> choose current User --> unlock -->right tap current User --> Advanced option --> change you full name & above account name to your want, save ,that is ok! I get it from How does Xcode know who the the project was "created by"? @Juzzz 's answer. hope that will help.
File -> Save saves the current file, which is the one in the currently active editing pane. You can hold down the Option key when choosing from the File menu to save all files that have changes. (The default key equivalents are Command-S and Command-Option-S.)
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.
Update For newer versions of Xcode the updated path will be: ~/Library/Developer/Xcode/Templates/File Templates/Source
This may be useful for somebody:
As for XCode 6 to XCode 9 the file templates are in:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Source
Update: As @carbo18 noted, it's proably better to create the directory ~/Library/Developer/Xcode/Templates/File Templates/Source
and put your custom templates there. The best way may be to use as base one of the ones in /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With