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模板导入完成。