如何在创buildxcode项目模板时添加“类前缀”字段
我正在使用已经由某个人定义的自定义模板。 当我使用该模板时,Xcode不要求"Class Prefix"
。 正因为如此,使用这个模板创build的类有什么类名称作为项目名称,后面跟着我们给出的类名"SampleProjectViewController.h"
或"SampleProjectViewController.m"
。
有没有办法添加"Class Prefix"
字段,并使用此类前缀,而创build新的类,所以,当我创build一个新的类,期望的类名称将SPViewController.h
或SPViewController.m
?
将com.apple.dt.unit.prefixable
添加到祖先,它会自动添加对话框。 然后,使用___VARIABLE_classPrefix:identifier___
作为replacestring。 例如。 假设你有一个名为Foo的类:
@interface ___VARIABLE_classPrefix:identifier___Foo : NSObject @end @implementation ___VARIABLE_classPrefix:identifier___Foo @end
文件不需要那么长的前缀,你可以简单地在你的定义中使用___VARIABLE_classPrefix:identifier___Foo.m
作为键, Foo.m
作为Path
(或者你的命名)。