我一直在玩项目模板,以便创建自定义模板。我知道如何创建子组,甚至创建一个由组表示的空文件夹。但是当我尝试使用子文件夹创建更复杂的结构时,问题就出现了。我得到的最接近的方法是使用TemplateInfo.plist中的这些代码行:
<key>Definitions</key>
<dict>
<key>Parent</key>
<dict>
<key>Path</key>
<string>Parent</string>
</dict>
<key>Parent/Child</key>
<dict>
<key>Group</key>
<array>
<string>Parent</string>
</array>
<key>Path</key>
<string>Parent/Child</string>
</dict>
</dict>
<key>Nodes</key>
<array>
<string>Parent</string>
<string>Parent/Child</string>
</array>
但是这会添加两个对Child的引用,一个指向正确的Child文件夹,另一个指向Parent。
P.S。在.xctemplate中我还有相同结构的空文件夹。
答案 0 :(得分:1)
好吧,我回答自己希望它会对其他人有所帮助。
仅定义文件夹将列出其余内容,因此如果它有一个子文件夹,它会将其作为一个组添加到项目中,并附带该文件夹的相关链接。
<key>Definitions</key>
<dict>
<key>Parent</key>
<dict>
<key>Path</key>
<string>Parent</string>
</dict>
</dict>
<key>Nodes</key>
<array>
<string>Parent</string>
</array>
但这给我们带来了另一个问题。如果有文件,它会将最后一个识别为产生一些有趣结果的文件夹。
我不知道这是xcode的错误还是我正在使用hack来列出子文件夹。
我希望其他人能找到解决这个问题的方法。