2

在 Xcode 7.3 和 swift 2.2 之后,我在 @interface 和 @end 关键字中定义的常量不能在 swift 中访问,可能是 swift 将它们标记为私有或类似的东西。

如何让我的常量在 swift 代码中公开可用。

// Constants.h
@interface Test
    extern NSString * const BASE_URL;
@end

// Constants.m
@implementation Test
    NSString * const BASE_URL=@"http://my-server.com/";
@end

有人建议在这里从@interface 中取出常量以使其可见,但我不确定此解决方案的后果。

任何想法如何使它正确修复。

4

0 回答 0