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

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.

主站蜘蛛池模板: 丘北县| 平南县| 清丰县| 高淳县| 民乐县| 商洛市| 徐州市| 栾城县| 六盘水市| 尼玛县| 额敏县| 麻江县| 通榆县| 吉林省| 绥阳县| 包头市| 济阳县| 洱源县| 兴业县| 三门峡市| 霍州市| 文成县| 正定县| 巩义市| 中山市| 类乌齐县| 宕昌县| 诸城市| 岐山县| 扬中市| 天津市| 固阳县| 吉林省| 南充市| 延吉市| 中牟县| 张掖市| 东城区| 鄂托克旗| 秦安县| 喀喇沁旗|