Is there any way to automatically add package/target name and copyright + company name to the header when creating new files while developing a swift package with Xcode 12/13?
Just create a new package (File > New > Package) and add a new file to the sources (File > New > File).
Currently gives me this:
//
// File.swift
//
//
// Created by User Name on 02.10.21.
//
instead of this (like when adding files to regular Xcode project):
//
// File.swift
// MyPackage
//
// Created by User Name on 02.10.21.
// Copyright © 2021 Company Name. All rights reserved.
//
Thanks!
<?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___
// ___WORKSPACENAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright © 2021 Your Name Or Company. All rights reserved.
</string>
</dict>
</plist>
put this file in one of the following locations,
a. Has an impact on files created by the specified user (username) in the current workspace:
<Your Package Root>/.swiftpm/xcode/package.xcworkspace/xcuserdata/<Your username>.xcuserdatad/IDETemplateMacros.plist
b. Affects files created by all members in the current workspace:
<Your Package Root>/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDETemplateMacros.plist
Note:
If you cannot see the .swiftpm
folder even when "showing hidden files" is enabled, please double click the Package.swift
file to open the package in Xcode. Then you will find the .swiftpm
file created.
you should right click 'show package content' of the package.xcworkspace to get inside screen shot
Update: