XCode 自定义模板 - 仅用于复选框的文件夹结构(在哪里放置变体“未勾选复选框")? [英] XCode custom template - folder structure for only a checkbox (where to put variation "checkbox not ticked")?

查看:28
本文介绍了XCode 自定义模板 - 仅用于复选框的文件夹结构(在哪里放置变体“未勾选复选框")?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了本教程

当我取消选中复选框时,没有生成任何文件.但是,当我选中复选框时它会起作用.

我需要为变体未勾选复选框"创建什么文件夹?我找不到解决方案.

谢谢

解决方案

在深入研究默认 Xcode 模板后,我发现其中一个也只使用了一个复选框,即 C 文件模板:

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\ Templates/Source/C\ File.xctemplate

查看它们的结构,它从 Default 目录中读取模板文件,没有选择任何内容.选中复选框后,它将从与复选框选项的 Identifier 值相同的目录中读取.

I followed this tutorial "Advanced Xcode 9 File Template" to create a more advanced template for XCode. It is explained that you need to create a folder with a specific name for every option variation there is. In the tutorial, there was a dropdown menu and a checkbox.

But what if I only have a checkbox? Following the tutorial, I'd need to create a folder without a name. That's not possible. Thus, I tried it without a folder for that variation (the checkbox identifier is CreateModelAttributeInSection):

When I uncheck the checkbox though, there are no files being generated. It works when I do check the checkbox, however.

What folder do I need to create for the variation "checkbox not ticked"? I can't find a solution.

thank you

解决方案

After diving in to the default Xcode templates I found one of theirs that also just used a single checkbox, which is the C file template:

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\ Templates/Source/C\ File.xctemplate

Looking at their structure, with nothing selected it reads the template files from the Default directory. With the checkbox checked it'll read from the directory named the same as the Identifier value of the checkbox option.

这篇关于XCode 自定义模板 - 仅用于复选框的文件夹结构(在哪里放置变体“未勾选复选框")?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆