官术网_书友最值得收藏!

Renaming classes

The first step would be to rename the classes and enums so they don't expose this ugly FV prefix:

typedef NS_ENUM(NSInteger, FVMeasureUnit) {
/* ... */
} NS_SWIFT_NAME(MeasureUnit); // notice the attribute is 'after'

// And for interfaces the attribute is before
NS_SWIFT_NAME(Measure)
@interface FVMeasure : NSObject

We can now rewrite our Swift to the following:

let measure = Measure(amount: 10, unit: MeasureUnit.cups)

The class and enum names are quite better but we can go further.

主站蜘蛛池模板: 宝清县| 原阳县| 新河县| 井冈山市| 大港区| 鄂州市| 宁城县| 共和县| 龙川县| 靖安县| 久治县| 福州市| 桃园市| 淮阳县| 娱乐| 湖北省| 临高县| 若尔盖县| 南雄市| 丽水市| 南皮县| 思茅市| 南召县| 鄱阳县| 广东省| 怀来县| 延寿县| 华容县| 绩溪县| 增城市| 巴楚县| 冀州市| 衡阳县| 曲松县| 马关县| 峨山| 南召县| 辰溪县| 哈巴河县| 牙克石市| 新宁县|