1

我一直在使用项目模板来创建自定义模板。我知道如何创建子组,甚至创建一个由组表示的空文件夹。但是当我尝试使用子文件夹创建更复杂的结构时,问题就来了。我得到的最接近的方法是在 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>

但这是添加两个对子项的引用,一个指向正确的子文件夹,另一个指向父文件夹。

PS 在 .xctemplate 中,我也有相同结构的空文件夹。

4

1 回答 1

1

Well, I answer myself hoping it will be helpful to somebody else.

Just defining the folder will list the rest of the content, so if it has a subfolder it will add it as a group to the project with its related link to the folder.

<key>Definitions</key>
<dict>
    <key>Parent</key>
    <dict>
        <key>Path</key>
        <string>Parent</string>
    </dict>
</dict>
<key>Nodes</key>
<array>
    <string>Parent</string>
</array>

But this gives us another problem. In case of having files, it will recognize the last one as a folder producing kind of funny results.

enter image description here

I don't know if this is a bug of xcode or that I'm using kind of hack to list the subfolders.

I hope anybody else can find the solution to this problem.

于 2013-04-18T14:08:42.447 回答