Updating Xcode Project Template Details

Previously, all file headers were displayed as follows.

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

I changed the username from ABC_User_Name to XYZ_User_Name .

Now, even after logging out and logging in, I find the same headers in all project templates. How to update these templates with the current username?

Do I need to manually change them all?

+6
source share
2 answers

Source templates use this header:

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

Double underlined words are references to placeholders. There are 18 that I know of, and you can add more to your template definition. These parameters can be further modified using parameter variables. The ones you see above:

  • ___FULLUSERNAME___ Full name of the user (first name + last name).
  • __YEAR__ Current year.
  • ___ORGANIZATIONNAME___ The name of your organization, as shown in your address book. You can change it for each project by selecting Project node and setting it to Organization.

After creating a project, the title becomes plain text and is never updated.


For future projects, I suggest you duplicate templates and make changes there. Otherwise, you risk screwing up the original templates or rewriting your changes to Xcode.

Originals:

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

And I made a copy:

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

where "Yano" is my user and it will be displayed as a category of a template on the screen for selecting a new project.

User templates

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

+4
source

Xcode 4 saves this based on each project.

If you select a project in the Project Navigator (Cmd-1) and open the “File Inspector” (Cmd-Opt-1), you will see the “Organization” field in the “Project Document”.

+4
source

Source: https://habr.com/ru/post/900415/


All Articles