4

I'm using Xcode 6.2 and I want to remove the information about the author/user/organisation at the beginning.

E.g.

//
//  AppDelegate.h
//  SomeProject
//
//  Created by Some One on 31.03.15.
//  Copyright (c) 2015 Some Organisation. All rights reserved.
//

Therefore I copied the files from the folder

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\ Templates/Source/Header\ File.xctemplate/

to

/Users/my-user/Library/Developer/Xcode/Templates/File\ Templates/Source/Header\ File.xctemplate/

The content in ___FILEBASENAME___.h was

//
//  ___FILENAME___
//  ___PROJECTNAME___
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//___COPYRIGHT___
//

#ifndef ___PROJECTNAMEASIDENTIFIER_______FILEBASENAMEASIDENTIFIER_______FILEEXTENSION___
#define ___PROJECTNAMEASIDENTIFIER_______FILEBASENAMEASIDENTIFIER_______FILEEXTENSION___


#endif

and I changed it to

//
//  ___FILENAME___
//  ___PROJECTNAME___
//
//  Created on ___DATE___.
//

#ifndef ___PROJECTNAMEASIDENTIFIER_______FILEBASENAMEASIDENTIFIER_______FILEEXTENSION___
#define ___PROJECTNAMEASIDENTIFIER_______FILEBASENAMEASIDENTIFIER_______FILEEXTENSION___


#endif

If I create a new Cocoa Touch class I always get the same old header. I also tried other categories (e.g. Cocoa Class.xctemplate, Objective-C File.xctemplate, Objective-C new superclass.xctemplate, ...), but nothing changed. What I'm doing wrong or which template is the correct one?

Links:
- Change templates in Xcode
- Changing the default header comment license in Xcode
- Xcode change/remove comment template
- Change copyright / top-comment / “header” on ALL new files in Xcode 5
- Remove copyright in Xcode generated source code

But most of the information there seems to be outdated.

Community
  • 1
  • 1
testing
  • 19,681
  • 50
  • 236
  • 417
  • Did you change the name of the template? – trojanfoe Mar 31 '15 at 09:56
  • @trojanfoe: No, I copied the structure (incl. all images) and edited the `___FILEBASENAME___.h` and `___FILEBASENAME___.m` files. – testing Mar 31 '15 at 09:57
  • You'll need to change the name of the template and then start using that template instead of the default one. – trojanfoe Mar 31 '15 at 09:58
  • And what do I have to do exactly? Should I change the folder `Header File.xctemplate` to `MyCustomTemplate.xctemplate`? And how can I select that template? – testing Mar 31 '15 at 10:02
  • If you've solved it, you should make your own answer and accept it, so as to let the site mark it as solved. – Harsh Sep 09 '16 at 13:58
  • @Harsh: What do you mean? Where do you see a solution? It isn't solved. – testing Sep 09 '16 at 14:00
  • I'm sorry, I assumed you did. Based on your last comment, you must have achieved what you wanted. What was the problem? After you've made a custom template with a different name, it can be found in the new file pop-up.. I'm stating the obvious, so is there something else that's not working? – Harsh Sep 09 '16 at 14:14
  • Thanks Harsh for your comment. The issue was that the company name as well as the author name was still there, despite I changed the template files. I've described the steps I've done in the question. But the main problem is that it is unclear how it's even done. If you have some instructions, you could post them as an answer. – testing Sep 09 '16 at 14:50

1 Answers1

1

Use IDETemplateMacros.plist or swiftlint rule

https://matrejek.eu/posts/customizing-xcode-header-comments/

Noor
  • 967
  • 7
  • 18