Xcode’s default file header is too boring or otherwise needs customization. Xcode 9 will support developer customization
The basic steps for customization are divided into two parts:
1/2 Create a configuration file
Go to Xcode -> New File -> select create plist (Proprety List) File and name it idetemplatemacros.plist.
Change Root to Dictionary and start setting up key-value pairs.
- The key for FILEHEADER
- Value is a string that you want to customize
- When configuring custom content, you can use macros predefined by the system.
Or you can provide a full plist content for manual modification.
<? The XML version = "1.0" encoding = "utf-8"? > <! DOCTYPE plist PUBLIC "- / / / / DTD plist Apple / 1.0 / EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > < plist Version ="1.0"> <dict> <key>FILEHEADER</key> <string> // ___FILENAME___ // ___PACKAGENAME___ // // Created by YourName on ___DATE___ // ___COPYRIGHT___ // </string> </dict> </plist>Copy the code
2/2 Select the file location
The scope of influence varies with the location where the file is stored.
- Modify only the files you create in project
<ProjectName>.xcodeproj/xcuserdata/[username].xcuserdatad/
Copy the code
- Modify the files created by everyone in project
<ProjectName>.xcodeproj/xcshareddata/IDETemplateMacros.plist
Copy the code
- Modify worksSpace only the files you created
<WorkspaceName>.xcworkspace/xcuserdata/[username].xcuserdatad/
Copy the code
- Modify files created by everyone in worksSpace
<WorkspaceName>.xcworkspace/xcshareddata/
Copy the code
- Modify all files created by Xcode on this computer
~/Library/Developer/Xcode/UserData/
Copy the code
References:
Customizing the file header comment and other text macros in Xcode 9