Changing the default header comment license in Xcode
Solution 1:
With Xcode 9 there is a built-in option which you can find in the details below.
- Create a property list file named IDETemplateMacros.plist
- Add a
FILEHEADER
value to the Root and set its string value with your copyright text likeCopyright © 2017 ...
- Copy the file to one of the following locations
- For a single project and user
<ProjectName>.xcodeproj/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
- For all team members in a single project
<ProjectName>.xcodeproj/xcshareddata/IDETemplateMacros.plist
- For all projects in a workspace for a single user
<WorkspaceName>.xcworkspace/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
- For all projects in a workspace for all team members
<WorkspaceName>.xcworkspace/xcshareddata/IDETemplateMacros.plist
- For everything you work on, regardless of project
~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist
- For a single project and user
- Create a new file - you should see the new copyright header
Sample IDETemplateMacros.plist
for copy and paste:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string>
// Created by Your Name on 29.12.17.
// Copyright © 2017 Your Company. All rights reserved.
// </string>
</dict>
</plist>
Solution 2:
First try changing your Name and Organization your contact card in Address Book.
If that doesn't work, open System Preferences > Users & Groups > Right click on your user (System Preferences must already be unlocked) > Advanced Options... > Change the name in the Full Name text box.
To change the organization name in Xcode click on the project file so it is selected (left sidebar of Xcode in the Project navigator) > In the File Inspector (right sidebar of Xcode) change the Organization text box.
Solution 3:
This blog post has some good steps for modifying file templates in Xcode 4.3:
http://error-success.piku.org.uk/2012/04/27/how-to-make-xcode-4-3-2-templates/
The /Developer
folder no longer exists, so you copy the templates from within the Xcode.app bundle located in /Applications
:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\ Templates/
And place your modified copy here, as before:
~/Library/Developer/Xcode/Templates/File\ Templates/
UPDATE: I decided to write a script that would extract the built in Xcode templates and replace the headers. Source and instructions can be found at the following url:
https://github.com/royclarkson/xcode-templates
Solution 4:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates
any update of your SDK will wipe changes here so keep your template backed up somewhere else