如何在 Xcode 8 iOS 项目向导中获取自定义选项值?
How to get custom options value in Xcode 8 iOS project wizard?
我已经创建了自定义 ios 项目模板,并且在为您的项目向导选择选项中添加了名称、电子邮件和移动选项,它们是项目创建 (PFA) 所必需的。如何在项目创建后获取这些选项值。
TemplateInfo.plist :
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>com.test</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.storyboardApplication</string>
<string>com.apple.dt.unit.coreDataCocoaTouchApplication</string>
</array>
<key>Concrete</key>
<true/>
<key>Description</key>
<string>This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a storyboard or nib file that contains the view.</string>
<key>SortOrder</key>
<integer>1</integer>
<key>Options</key>
<array>
<dict>
<key>Description</key>
<string>Name.</string>
<key>EmptyReplacement</key>
<string>Name</string>
<key>Identifier</key>
<string>Name</string>
<key>Name</key>
<string>Name</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Description</key>
<string>Email address.</string>
<key>EmptyReplacement</key>
<string>Email</string>
<key>Identifier</key>
<string>Email</string>
<key>Name</key>
<string>Email</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Description</key>
<string>Mobile number.</string>
<key>EmptyReplacement</key>
<string>Mobile</string>
<key>Identifier</key>
<string>Mobile</string>
<key>Name</key>
<string>Mobile</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Identifier</key>
<string>languageChoice</string>
<key>Units</key>
<dict>
<key>Swift</key>
<dict>
<key>Nodes</key>
<array>
<string>AppDelegate.swift</string>
<string>ViewController.swift</string>
</array>
</dict>
</dict>
</dict>
</array>
<key>Definitions</key>
<dict>
<key>Base.lproj/Main.storyboard</key>
<dict>
<key>Path</key>
<string>Main.storyboard</string>
<key>SortOrder</key>
<integer>99</integer>
</dict>
<key>AppDelegate.swift</key>
<dict>
<key>Path</key>
<string>AppDelegate.swift</string>
</dict>
<key>ViewController.swift</key>
<dict>
<key>Path</key>
<string>ViewController.swift</string>
</dict>
</dict>
</dict>
</plist>
<key>Identifier</key>
<string>name</string>
自定义选项值将以 ___VARIABLE_identifier___ 格式创建。
您可以使用此 ___VARIABLE_name___
获取 name 选项值
我已经创建了自定义 ios 项目模板,并且在为您的项目向导选择选项中添加了名称、电子邮件和移动选项,它们是项目创建 (PFA) 所必需的。如何在项目创建后获取这些选项值。
TemplateInfo.plist :
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>com.test</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.storyboardApplication</string>
<string>com.apple.dt.unit.coreDataCocoaTouchApplication</string>
</array>
<key>Concrete</key>
<true/>
<key>Description</key>
<string>This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a storyboard or nib file that contains the view.</string>
<key>SortOrder</key>
<integer>1</integer>
<key>Options</key>
<array>
<dict>
<key>Description</key>
<string>Name.</string>
<key>EmptyReplacement</key>
<string>Name</string>
<key>Identifier</key>
<string>Name</string>
<key>Name</key>
<string>Name</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Description</key>
<string>Email address.</string>
<key>EmptyReplacement</key>
<string>Email</string>
<key>Identifier</key>
<string>Email</string>
<key>Name</key>
<string>Email</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Description</key>
<string>Mobile number.</string>
<key>EmptyReplacement</key>
<string>Mobile</string>
<key>Identifier</key>
<string>Mobile</string>
<key>Name</key>
<string>Mobile</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Identifier</key>
<string>languageChoice</string>
<key>Units</key>
<dict>
<key>Swift</key>
<dict>
<key>Nodes</key>
<array>
<string>AppDelegate.swift</string>
<string>ViewController.swift</string>
</array>
</dict>
</dict>
</dict>
</array>
<key>Definitions</key>
<dict>
<key>Base.lproj/Main.storyboard</key>
<dict>
<key>Path</key>
<string>Main.storyboard</string>
<key>SortOrder</key>
<integer>99</integer>
</dict>
<key>AppDelegate.swift</key>
<dict>
<key>Path</key>
<string>AppDelegate.swift</string>
</dict>
<key>ViewController.swift</key>
<dict>
<key>Path</key>
<string>ViewController.swift</string>
</dict>
</dict>
</dict>
</plist>
<key>Identifier</key>
<string>name</string>
自定义选项值将以 ___VARIABLE_identifier___ 格式创建。 您可以使用此 ___VARIABLE_name___
获取 name 选项值