Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating XCode project template details

Previously all file headers were being displayed as follows.

//  Created by ABC_User_Name on 10/31/11.

I have modified user name from ABC_User_Name to XYZ_User_Name.

Now, even after logging out & logging in again, I am finding the same headers in all project templates. How to update those templates with current user-name ?

Do I need to modify manually all of them ?

like image 590
Sagar Kothari Avatar asked Oct 31 '11 08:10

Sagar Kothari


1 Answers

The original templates use this header:

//  Created by ___FULLUSERNAME___.
//  Copyright ___YEAR___ ___ORGANIZATIONNAME___. All rights reserved.

The words with the double underscore are placeholder references. There are 18 that I know of, and you can add more in your template definition. These options can be further modified using option variables. The ones you see above are:

  • ___FULLUSERNAME___ Full user name of the current user (name + surname).
  • __YEAR__ Current year.
  • ___ORGANIZATIONNAME___ The name of your organization as seen on your address book. You can change it for each project selecting the Project node and setting the Organization field.

Once the project is created, the header becomes plain text and is never updated.


For future projects I suggest you duplicate the templates and do the changes there. Otherwise you risk screwing up the original templates or having Xcode overwrite your changes.

The originals are at:

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

And I made a copy at:

mkdir -p ~/Library/Developer/Xcode/Templates/File\ Templates/Jano
mkdir -p ~/Library/Developer/Xcode/Templates/Project\ Templates/Jano

where "Jano" is my user and it will show as a template category in the new project selection screen.

User templates

Then you edit the header manually file by file, or from bash using sed.

like image 87
Jano Avatar answered Sep 18 '22 10:09

Jano