美文网首页
自定义MVC开发的Xcode模板

自定义MVC开发的Xcode模板

作者: jackyshan | 来源:发表于2020-06-11 15:26 被阅读0次

前言

Xcode分为系统模板和自定义模板。模板的好处如下:

1、节省重复代码手写时间

2、统一规范代码,提高代码可读性

3、减少手写代码,XIB或修改相关配置等不必要的时间

iOS系统模板路径如下:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates

自定义模板路径如下:

~/Library/Developer/Xcode/Templates

自定义模板

文件夹

终端打开自定义模板路径

open ~/Library/Developer/Xcode

Xcode目录下依次新建文件夹

Templates-Custom Templates-MVC.xctemplate

TemplateInfo文件

<?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>

MVC模板文件

https://github.com/jackyshan/XcodeiOSTemplate

Xcode新建-选择模板

command+n

输入Module Name

创建文件夹及文件

这种引用目录不是我想要的,删掉-Remove Reference,重新导入文件夹TY_MeiyanSP,选择Create groups

MVC模板导入完成。

相关文章

网友评论

      本文标题:自定义MVC开发的Xcode模板

      本文链接:https://www.haomeiwen.com/subject/mhebtktx.html