9

I'm an independent developer working primarily with iPhone applications, and I'm currently engaged in several different projects. Some are for myself, and others are for one of a number of clients. Because of this, I'd like to have a way to have Xcode set the copyright notice at the top of each source file on a per-project basis.

I've seen these questions, and I understand that Xcode by default pulls the organization on the user's Address Book contact card for the copyright statement, and that you can change the property either in the Address Book or on the terminal. What I'm looking for is a setting that lets that default be changed for each project, and has Xcode remember the copyright assignee (i.e. I don't want to have to change my Address Book organization entry each time I switch projects).

Community
  • 1
  • 1
Tim
  • 59,527
  • 19
  • 156
  • 165

4 Answers4

5

You can change the organization Xcode currently uses by issuing the following command in Terminal:

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ORGANIZATIONNAME = "Some Company Name"; }'

You can then create scripts that switch the current company for Xcode.

diederikh
  • 25,221
  • 5
  • 36
  • 49
  • Can you be more specific? Where would I place these scripts? How would I trigger them to run? I'd really like a system that's as painless as possible - running a script before each project switch is almost as bad as typing the command myself each time. – Tim Jun 14 '09 at 09:25
  • 1
    You could add the command as a build script so it will be dependent on your Xcode project file. But then you first have to build the project before adding any new files which might not be what you want. – diederikh Jun 15 '09 at 20:39
3

Upgrade to Xcode 3.2, which now has a project setting for organization name.

AWrightIV
  • 553
  • 7
  • 15
palimpsestor
  • 1,038
  • 1
  • 8
  • 28
2

You might want to make custom templates. Have a look at this question: Change templates in Xcode

Community
  • 1
  • 1
Richard Hoskins
  • 2,172
  • 2
  • 13
  • 9
0

look in text macros section:

Change the text used for the header of a new file by setting the value of the FILEHEADER text macro.

The example shows the default definition for the macro. Other macros are included in the definition by including three underscore (___) characters before and after the name of the macro. The line with COPYRIGHT is included only if an organization name is set.

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