Xcode’s default copyright header sucks. Fortunately you can change it on a per project (workspace) level or systemwide…both for a single user and also for all users. All you need is an appropriately formatted plist file in the right location.
(This doc reflects Xcode 9+.)
This depends on which level you want affected:
ProjectName.xcodeproj/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDETemplateMacros.plist
ProjectName.xcodeproj/xcshareddata/IDETemplateMacros.plist
WorkspaceName.xcworkspace/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
WorkspaceName.xcworkspace/xcshareddata/IDETemplateMacros.plist
~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist
The file should contain the text and can also contain some placeholder variables surrounded by three underscores such as ___VARIABLE__
. Here is a full example:
<?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>
// (c) Company Name GmbH (___YEAR___)
//
// This computer program is the sole property of Company
// Name GmbH (http://www.company.com) and is protected
// under the German Copyright Act (paragraph 69a UrhG).
//
// All rights are reserved. Making copies, duplicating,
// modifying, using or distributing this computer program
// in any form, without prior written consent of Company
// Name GmbH, is prohibited.
//
// Violation of copyright is punishable under the German
// Copyright Act (paragraph 106 UrhG).
//
// Removing this copyright statement is also a violation.
</string>
</dict>
</plist>