At the moment, some #define
s are converted and some aren't. More specifically:
#define A 1
...becomes:
var A: CInt { get }
Or:
#define B @"b"
...becomes:
var B: String { get }
Unfortunately, YES
and NO
aren't recognized and converted on the fly by the Swift compiler.
I suggest you convert your #define
s to actual constants, which is better than #define
s anyway.
.h:
extern NSString* const kSTRING_CONSTANT;
extern const BOOL kBOOL_CONSTANT;
.m
NSString* const kSTRING_CONSTANT = @"a_string_constant";
const BOOL kBOOL_CONSTANT = YES;
And then Swift will see:
var kSTRING_CONSTANT: NSString!
var kBOOL_CONSTANT: ObjCBool
Another option would be to change your BOOL
defines to
#define kBOOL_CONSTANT 1
Faster. But not as good as actual constants.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…