咱們打開 Xcode 工程的時候新建的文件頂部的信息很是的少且不是咱們須要展現信息,看到不少的 GitHub 項目的頂部的頭信息仍是很是的花哨,因此在此記錄如何寫自定義模版的文章。git
// // MASLayoutConstraint.h // Masonry // // Created by Jonas Budelmann on 3/08/13. // Copyright (c) 2013 Jonas Budelmann. All rights reserved. //
// // SDGFasterEncoder.h // XQ_Persistance // // Author: @杭城小劉 // Github: https://github.com/FantasticLBP // E-mail: wsbglbp@outlook.com // // Created by 杭城小劉 on 2019/1/23 //
咱們利用 Xcode9 新特性,自定義文本宏,來實現上述的需求。github
選中項目的 **.xcodeproj 文件xcode
顯示包內容app
進入 xcshareddata 文件夾spa
將以前完成的 IDETemplateMacros.plist 複製到xcshareddata 下面和 xcschemes 的同級目錄code
打開 XQ_Persistance.xcworkspacexml
顯示包內容string
進入 xcuserdata 文件夾it
將 IDETemplateMacros.plist 複製進去,生效io
<?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___ // // Author: @杭城小劉 // Github: https://github.com/FantasticLBP // E-mail: wsbglbp@outlook.com // // Created by 杭城小劉 on ___DATE___ // </string> </dict> </plist>