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

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.

主站蜘蛛池模板: 古浪县| 潼南县| 剑川县| 从化市| 新民市| 张家界市| 大方县| 深州市| 定南县| 凤庆县| 瑞昌市| 西林县| 青龙| 吴桥县| 左云县| 准格尔旗| 自治县| 西和县| 河西区| 舞阳县| 建阳市| 吉安县| 永城市| 永城市| 湖口县| 佳木斯市| 无棣县| 太仓市| 陆良县| 二连浩特市| 中方县| 漳平市| 剑川县| 榆树市| 祁东县| 元氏县| 庆云县| 房山区| 成都市| 乌拉特中旗| 万州区|