Xcode分爲系統模板和自定義模板。模板的好處以下:git
一、節省重複代碼手寫時間github
二、統一規範代碼,提升代碼可讀性bash
三、減小手寫代碼,XIB或修改相關配置等沒必要要的時間app
iOS系統模板路徑以下:iphone
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates
複製代碼
自定義模板路徑以下:ui
~/Library/Developer/Xcode/Templates
複製代碼
終端打開自定義模板路徑spa
open ~/Library/Developer/Xcode
複製代碼
Xcode目錄下依次新建文件夾3d
Templates-Custom Templates-MVC.xctemplate
複製代碼
<?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>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Platforms</key>
<array>
<string>com.apple.platform.iphoneos</string>
</array>
<key>Options</key>
<array>
<dict>
<key>Identifier</key>
<string>productName</string>
<key>Required</key>
<true/>
<key>Name</key>
<string>Module Name</string>
<key>Description</key>
<string>template</string>
<key>Type</key>
<string>text</string>
<key>Default</key>
<string>ok Template</string>
<key>Group</key>
<array>
<string>productName</string>
</array>
</dict>
</array>
</dict>
</plist>
複製代碼
https://github.com/jackyshan/XcodeiOSTemplate
複製代碼
command+ncode
輸入Module Nameorm
建立文件夾及文件
這種引用目錄不是我想要的,刪掉-Remove Reference,從新導入文件夾TY_MeiyanSP,選擇Create groups
MVC模板導入完成。