Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 757
Misha M Avatar asked Aug 29 '08 00:08

Misha M


People also ask

Where can I find Xcode templates?

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.

How do I add a template to Xcode?

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.

How do I change created in Xcode?

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.

How do I save a project in Xcode?

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.)


2 Answers

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

like image 123
Chris Hanson Avatar answered Sep 28 '22 07:09

Chris Hanson


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

like image 31
pconcepcion Avatar answered Sep 28 '22 06:09

pconcepcion