I\'m trying to use a third-party Objective-C library in a Swift project of mine. I have the library successfully imported into Xcode, and I\'ve made a
What I did is to create a class method that returns the #define.
Example:
.h file:
#define AD_SIZE CGSizeMake(320, 50)
+ (CGSize)adSize;
.m file:
+ (CGSize)adSize { return AD_SIZE; }
And in Swift:
Since this is a class method you can now use it almost as you would the #define. If you change your #define macro - it will be reflected in the new method you created In Swift:
let size = YourClass.adSize()