How to change entire copyright notice template for Xcode?
Asked Answered
P

1

13

I've found a few answers on how to change your company name, but is there any way to change the entire copyright template in Xcode?

For example:

Change :

(c) 2012 MyCoolCompany

to :

(c) 2012 MyCoolCompany, unauthorized reproduction is prohibited, contact [email protected] for details, etc.
Playwright answered 10/4, 2012 at 22:9 Comment(0)
T
20

Go to :

/Developer/Library/Xcode/Templates/File Templates

or if you're using the newer self contained Xcode.app,

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Tem‌​plates/File Templates

To avoid the templates from being clobbered by Xcode updates, make a copy of the template that you want to edit and move it to your home library folder–

~/Library/Application Support/Developer/Shared/Xcode/File Templates

If - let's say - it's the Objective-C class template you want to change then, go to the following subdirectory :

/Cocoa/Objective-C class.xctemplate

Open :

NSObject/___FILEBASENAME___.h
NSObject/___FILEBASENAME___.m

And edit them.


Hint : You'll have to tweak as many template files as you need (e.g. if you need your copyright header to be valid for NSDocument subclasses, then make sure you edit those files too... ;-))


An example (of what my ___FILEBASENAME___ files look like) :

/******************************************************
 | ___PROJECTNAME___
 |******************************************************
 | File : ___FILENAME___
 | 
 | Created on ___DATE___
 | By Ioannis Zafeiropoulos (a.k.a. Dr.Kameleon)
 |*********************************************************************
 | Copyright (c) ___YEAR___ InSili.co.uk. All rights reserved.
 |*********************************************************************/
Tetanus answered 10/4, 2012 at 22:10 Comment(5)
@Playwright You're welcome, my friend! - I myself have had lots of trouble with that quite a while ago, and it's definitely one of those features that are NOT so well documented by Apple (if at all) (Btw, just edited a bit, so that it's a bit more... explanatory)Tetanus
With iOS 5.2 SDK and the self-contained Xcode.app, that location would translate to /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File TemplatesKaenel
@Kaenel The funny thing is that I updated to 4.2 on my Snow Leopard-powered iMac just yesterday, and JUST realised that my custom template files are gone. What's even crazier is that I'm editing the files at the above location (the one I posted) and nothing seems to change when I create e.g. a new NSObject subclass. What could be going wrong? (I don't think there are located anywhere else, as I've searched for them...)Tetanus
@Tetanus try doing a search for // ___PROJECTNAME___ to make sure you edited all of the available templates.Kaenel
You should use your home library folder for custom templates, to avoid them being clobbered by updates -- ~/Library/Application Support/Developer/Shared/Xcode/File TemplatesMiddleaged

© 2022 - 2024 — McMap. All rights reserved.