简体   繁体   English

如何使用Xcode 9.x在自定义项目模板中添加“带有文件夹的新组”?

[英]How to add “New Group with Folder” in custom project template by using Xcode 9.x?

I have a custom Xcode project template which generates a project and adds los of Swift boilerplate source files in custom folders. 我有一个自定义的Xcode项目模板,该模板生成一个项目,并在自定义文件夹中添加Swift样板源文件的丢失。 My problem is that I can only create group folders like this: 我的问题是我只能创建这样的组文件夹: 在此处输入图片说明 , which represents a Group not associated with a file system directory. ,代表与文件系统目录不关联的组。 It's not good because if you later rename a folder in Xcode, it will have no effect on the corresponding file system directory. 这不是很好,因为如果以后在Xcode中重命名文件夹,则该文件夹将对相应的文件系统目录无效。

My goal is to write an Xcode project template that adds my custom boilerplate swift files in real reference folders like this: 我的目标是编写一个Xcode项目模板,将我的自定义样板swift文件添加到真正的参考文件夹中,如下所示: 在此处输入图片说明

Please help me to achieve this. 请帮助我实现这一目标。 Thank You :) 谢谢 :)

For me it works on right click. 对我来说,它可以右键单击。 However, if it already is a Group with folder it will display New Group without Folder 但是,如果它已经是带有文件夹的组,则将显示New Group without Folder

右键点击网上论坛

Here is my solution. 这是我的解决方案。 In the node section specify the group before naming the file. 在命名文件之前,在节点部分中指定组。

<key>Nodes</key>
<array>
<string>MyGroup/File.swift:comments</string>
<array>

Next in the definitions provide the group name in the key like so: 定义中的下一步在密钥中提供组名,如下所示:

<key>Definitions</key>
<dict>
<key>MyGroup/File.swift</key>
<dict>
<key>Path</key>
<string>File.swift</string>
<key>Group</key>
<string>MyGroup</string>
</dict>

Hopefully this will help. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM