Hacker News new | ask | show | jobs
by politician 1107 days ago
Incidentally, the same strong security measures have to be disabled to change the code templates that start every new Swift code file with a comment block containing the current date and the name of the person that created the file. I will never understand what led to this— it’s as if they created this before source control existed.
1 comments

It’s ‘underdocumented’, but you don’t have to do that to remove those.

If you search for “Customize the header used for new files” in Xcode’s help, you can find:

Change the text used for the header of a new file by setting the value of the FILEHEADER text macro.

Most of the templates start with

  //___FILEHEADER___
, so you can’t remove the initial “//“, but you can remove the rest.

Changing the value of the macro can be done by creating or editing a .plist file:

Text macros are symbols that are expanded in-place to the specified text. They are used in files and other places in Xcode, such as the header text for a new file or the project name. You can customize existing macros and add your own macros in a project, for all users of a project, or for all of Xcode. Customizing a macro requires two things:

- 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.