Last active
May 26, 2025 02:09
-
-
Save brennanMKE/660171e9dfa16892b41f4bc0b3a7410f to your computer and use it in GitHub Desktop.
Revisions
-
brennanMKE revised this gist
Dec 21, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Xcode File Header Templates Each time a new file is added in Xcode a header is added to the top. This is a good place to put a license or copywrite message. Xcode does support templates which are covered below. Placing a file named `IDETemplateMacros.plist` at one of the paths listed below with the contents which include `FILEHEADER`. -
brennanMKE created this gist
Dec 21, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ <?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> // Copyright © ___YEAR___ ___ORGANIZATIONNAME___. // All Rights Reserved. </string> <key>ORGANIZATIONNAME</key> <string>ACME</string> </dict> </plist> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ Xcode File Templates Each time a new file is added in Xcode a header is added to the top. This is a good place to put a license or copywrite message. Xcode does support templates which are covered below. Placing a file named `IDETemplateMacros.plist` at one of the paths listed below with the contents which include `FILEHEADER`. The string value can also include placeholders covered by [Text macros reference] with some listed below. Wrap each text macro with 3 underscores to include them in the output. * `FILENAME` * `DATE` * `YEAR` * `ORGANIZATIONNAME` * `PACKAGENAME` * `PACKAGENAMEASIDENTIFIER` * `PRODUCTNAME` * `PROJECTNAME` * `WORKSPACENAME` The sample `IDETemplateMacros.plist` included with this gist shows that a value for the text macro can be set, such as `ORGANIZATIONNAME`. Newly created files in any Swift packages or Xcode projects in this workspace will inherit this file header template and will be used if another template is defined. Below are the docs from Apple which and are copied here in case they are ever removed as others have been. ## Customize text macros * A plist named IDETemplateMacros.plist at an appropriate location. * An entry in IDETemplateMacros.plist for the text macro. Xcode looks for the value of a text macro in the following locations and uses the first matching macro: Project user data: `<ProjectName>.xcodeproj/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist` Project shared data: `<ProjectName>.xcodeproj/xcshareddata/IDETemplateMacros.plist` Workspace user data: `<WorkspaceName>.xcworkspace/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist` Workspace shared data: `<WorkspaceName>.xcworkspace/xcshareddata/IDETemplateMacros.plist` User Xcode data: `~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist` * [Customize text macros] [Customize text macros]: https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev91a7a31fc [Text macros reference]: https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev7fe737ce0 [Customizing the file header comment and other text macros in Xcode 9]: https://oleb.net/blog/2017/07/xcode-9-text-macros/