Sunday, May 15, 2011

Xcode File Templates

When creating a new source code file (from a template for example), the file starts with a comment specifying my name and a Copyright notice containing 'private' as the company name. I wanted to change the company name to something other than 'private'.

I started grepping around my project files and found a setting ORGANIZATIONNAME in the project's project.pbxproj file. Digging further (this time in Xcode help) I found that the default for that setting is __mycompanyname__. But where did that come from?

It appears that it comes straight from my address book under the entry for my name. Changing it there caused all my new Xcode projects to use the new company name. I had to restart Xcode for the change in the Address Book to take effect.

In order to change the setting for a specific project, this setting can also be changed from Xcode 4 IDE:
1. Click the blue project icon in the Project Navigator
2. Open the attributes window / pane (Command-Option-1)
3. In 'File Inspector' tab, under 'Project Document', you'll find the 'Organization' setting.

(the new setting will affect only new files).


References: StackOverflow