Another problem for this is changing the way the enumeration property is displayed in the interface builder. For example:
#if TARGET_INTERFACE_BUILDER @property (nonatomic, assign) IBInspectable NSInteger fontWeight; #else @property (nonatomic, assign) FontWeight fontWeight; #endif
This involves an enumeration called FontWeight. He relies on the fact that enumerations and their raw integer values ββcan be used somewhat interchangeably in Objective-C. After that, you can specify an integer in the interface builder for a property that is not ideal, but works and retains a small degree of security when using the same property programmatically.
This is a better alternative than declaring a single integer property, because you do not need to write additional logic to handle the second integer property, which can also be used to achieve the same.
However, this does not work with Swift, because we cannot implicitly cast from an integer in enum. Any thoughts on resolving this will be appreciated.
Anthony Mattox Oct 22 '15 at 2:07 2015-10-22 14:07
source share