[SWIFT] Changed comments automatically generated by Xcode and AppCode

Overview

When you create a new file with Xcode, the following comment is added to the header. I want to change this because my real name may be included.

//
//  ContentView.swift
//  Shared
//
//  Created by [name] on 2020/10/21.
//

Xcode Below are multiple paths for the template files. https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev91a7a31fc

In this User Xcode data: ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist You can set the file in.

  1. Open the file.
vim ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist
  1. The default template is below, so copy and paste it.
<?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___
//  ___TARGETNAME___
//  
//  Created by ___USERNAME___ on ___DATE___
//  ___COPYRIGHT___
//</string>
</dict>
</plist>
  1. Edit the template. If you want to delete the name, delete "\ __ USERNAME__". When displaying other items, refer to the following variables. https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev7fe737ce0

That's it. When you create a new file in Xcode, the comment specified in the template is inserted.

AppCode It is not changed by the same procedure as Xcode above. For AppCode, edit the following settings. スクリーンショット 2020-10-21 12.46.33.png

-Explanation of file templates https://pleiades.io/help/objc/using-file-and-code-templates.html

・ List of variables https://pleiades.io/help/objc/file-template-variables.html

The Copyright ~~ statement is not displayed unless the organization name ($ ORGANIZATION_NAME) is defined. To set, open the setting with "⌘;" and edit the Organization from the General tab.

Recommended Posts

Changed comments automatically generated by Xcode and AppCode
Automatically deploy applications by linking Github and Jenkins.