Creating sub-groups in XCode 4 Templates

前端 未结 2 2023
说谎
说谎 2020-12-05 16:31

While there is quite a lot of documentation and example for creating templates in XCode 3 converting them to XCode4 Templates is quite a nightmare...

First here is w

相关标签:
2条回答
  • 2020-12-05 16:52

    I've been struggling with this one myself too. As a workaround I've created and added a folder in my TemplateInfo.plist location (in your case that should be folder named Group1). The folder layout (subfolders and files) are the same as I want them to be in my project source tree ( e.g folder 'Group1' has subfolder 'Group2', folder 'Group2' has files File1.h and File1.m etc). Then I just add the root folder (Group1) in my TemplateInfo.plist file by defining it in the Definition section and by adding it to the Nodes section like this:

    <key>Definitions</key>
    <dict>
    <key>Group1/</key>
    <dict>
    <key>Path</key>
    <string>Group1/</string>
    <key>TargetIndices</key>
    <array/>
    </dict>
    
    <key>Nodes</key>
    <array>
    <string>Group1</string>
    </array>
    
    0 讨论(0)
  • 2020-12-05 17:02

    I've tried many times modify the TemplateInfo.plist and I've also tried to make a sub group and put files in them. Finally I found the solution:

    Definition section:

    <key>Definitions</key>
    <dict>
        <key>main.h</key>
        <dict>
            <key>Path</key>
            <string>main.h</string>
            <key>Group</key>
            <array>
                <string>parent</string>
                <string>child</string>
            </array>
        </dict>
    </dict>
    

    in the node section:

    <key>Nodes</key>
    <array>
        <string>main.h</string>
    </array>
    

    The code above will create groups parent and child. and the main.h is in the child

    Project
    --parent
    ---child
    ----main.h
    
    0 讨论(0)
提交回复
热议问题