Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the header comment for swift file

Custom the header comment for every project.

I created a plist file called IDETemplateMacros.plist and it's custom the header comment for all project but I need custom header for specific project, not for all the project and revert the custom text macro to default.

//
//  CategoryViewController.swift
//  ToDoey
//
//  Created by Swetha on 28/01/19.
//  Copyright © 2019 Swetha. All rights reserved.
//

to

//Hey..CategoryViewController.swift

I deleted the IDETemplateMacros.plist but it doesn't revert the text macro to default.

I expect the default text macro.

like image 865
Swetha Lakshmi Avatar asked Oct 27 '25 21:10

Swetha Lakshmi


1 Answers

You can override the text macros globally, or for an individual workspace or project. You can also decide to keep the macros for a single user or share it for all users.

The full list of locations that Xcode searches, in order of priority:

  • Project - single user
  • .xcodeproj/xcuserdata/[username].xcuserdatad/
  • Project - shared by all users
  • .xcodeproj/xcshareddata/
  • Workspace - single user
  • .xcworkspace/xcuserdata/[username].xcuserdatad/
  • Workspace - shared by all users
  • .xcworkspace/xcshareddata/
  • Globally for Xcode
  • ~/Library/Developer/Xcode/UserData/

In case you can't find the template file, you can make one with the name IDETemplateMacros.plist and this default content using textMacros:

<?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>
//  ___FILENAME___
//  ___PACKAGENAME___
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//  ___COPYRIGHT___
//
</string>
    <key>FULLUSERNAME</key>
    <string>ENTER-YOUR-NAME-HERE</string>
</dict>
</plist>
like image 54
Mojtaba Hosseini Avatar answered Oct 30 '25 13:10

Mojtaba Hosseini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!