December 2018
Intermediate to advanced
414 pages
10h 19m
English
Clang also provides macros that help to rename Objective-C classes and methods for Swift: NS_SWIFT_NAME.
Let's start with an example that could arise if you're writing a cooking application or any other app that requires measuring. When cooking, you'll often be hit with multiple volumes, units, and so on. It is possible to abstract it with a Measure class:
// A measuring unittypedef NS_ENUM(NSInteger, FVMeasureUnit) { FVLiters, FVMilliliters, FVCups};// The Measure class, @interface FVMeasure : NSObject@property (nonatomic, readonly) double amount;@property (nonatomic, readonly) FVMeasureUnit unit;+ (instancetype) measureWithAmount:(double) amount unit:(FVMeasureUnit) unit;+ (instancetype) withCups:( ...
Read now
Unlock full access