可悲的是,你不能暴露
struct,也不是Objective-
C的全局变量。请参阅文档。
到目前为止,恕我直言,最好的方法是这样的:
let ParseApplicationId = "xxx"let ParseClientKey = "xxx"let AppGreenColor = UIColor(red: 0.2, green: 0.7, blue: 0.3 alpha: 1.0)@objc class Constant: NSObject { private init() {} class func parseApplicationId() -> String { return ParseApplicationId } class func parseClientKey() -> String { return ParseClientKey } class func appGreenColor() -> UIColor { return AppGreenColor }}
在Objective-C中,您可以像这样使用它们:
NSString *appklicationId = [Constant parseApplicationId];NSString *clientKey = [Constant parseClientKey];UIColor *greenColor = [Constant appGreenColor];
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)