我试图创建MVVM模板来创建文件(不是项目)。
我想在创建文件时添加组(黄色文件夹),但是不能。创建它时,它会创建一个文件夹(蓝色文件夹)。
我该如何实现?
我尝试使用Node
和Definitions
,但它仍然显示蓝色文件夹。
我的MVVM.xctemplate层次结构是这样的:
-(文件夹) FILEBASENAME FILEBASENAME
---- ___ FILEBASENAME ___ ViewController.swift
-TemplateIcon.png
-TemplateIcon@2x.png
-TemplateInfo.plist
这是我的TemplateInfo.plist
文件
<?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.IDEFoundation.TextSubstitutionFileTemplateKind</string>
<key>Description</key>
<string>An empty MVVM Swift file.</string>
<key>Summary</key>
<string>An empty Swift MVVM file</string>
<key>AllowedTypes</key>
<array>
<string>public.swift-source</string>
</array>
<key>DefaultCompletionName</key>
<string>File</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.swift</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>Name:</string>
<key>Description</key>
<string>The name of the Navigator, ViewController and ViewModel to create</string>
<key>Type</key>
<string>text</string>
<key>Default</key>
<string>MyModel</string>
</dict>
</array>
<key>Definitions</key>
<dict>
<key>___FILEBASENAME___/___FILEBASENAME___ViewController.swift</key>
<dict>
<key>Group</key>
<array>
<string>___FILEBASENAME___</string>
</array>
<key>Path</key>
<string>___FILEBASENAME___/___FILEBASENAME___ViewController.swift</string>
<key>TargetIndices</key>
<array/>
</dict>
</dict>
<key>Nodes</key>
<array>
<string>___FILEBASENAME___/___FILEBASENAME___ViewController.swift</string>
</array>
</dict>
</plist>
谢谢。