December 2018
Intermediate to advanced
414 pages
10h 19m
English
Is is also possible to apply the NS_SWIFT_NAME macro to enum cases as well as class and instance methods:
// A measuring unittypedef NS_ENUM(NSInteger, FVMeasureUnit) { FVLiters NS_SWIFT_NAME(l), FVMilliliters NS_SWIFT_NAME(ml), FVCups,} NS_SWIFT_NAME(MeasureUnit);
Let's also rename one of the static initializers and the conversion method's name to something shorter:
+ (instancetype) withCups:(double) value NS_SWIFT_NAME(init(cups:));- (double) valueInUnit:(FVMeasureUnit) unit NS_SWIFT_NAME(in(unit:));
Notice how you declare an initializer with the init(cups:) syntax; this follows the same conventions as when you specify selectors in Swift.
Now it is possible to use the shorthand enum value when referencing ...
Read now
Unlock full access