Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode format pre-generated code

I have a particular format that I like to put my code in, and every time I create a new UIViewController (or any other class for that matter), the same auto-generated code from Apple is put in, and I have to spend the 2 minutes cleaning it up to be formatted the way I want it before I can even start.

I was wondering if there was a way to set it in Xcode to add in my version of the formatted code, so that I don't have to waste my time re-formatting. Thanks for the help!

like image 941
msgambel Avatar asked Oct 07 '11 17:10

msgambel


2 Answers

You will find all the templates that Xcode uses when you create new files in /Developer/Library/Xcode/Templates. Have a look in their, you should be able to figure out how it all words easily.

Hope it helps.

like image 184
Cthutu Avatar answered Sep 28 '22 06:09

Cthutu


XCode 4 changes how templates work, and where templates go, so be careful following instructions unless they refer to XCode 4. You can find a few template examples, and the paths to where they go in my XCode4 customization repository:

https://github.com/KiGi/XCode4Customization

The paths where the system templates live is:

/Developer/Platforms/iPhoneOS.platform/Developer/Library/ Xcode/Templates/File Templates

Don't change those, copy and modify in your own library directory:

~/Library/Developer/Xcode/UserData/File Templates

Those paths are also in the "WhereToPlaceFiles" RTF file on github.

like image 44
Kendall Helmstetter Gelner Avatar answered Sep 28 '22 04:09

Kendall Helmstetter Gelner