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

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.

主站蜘蛛池模板: 榆林市| 曲麻莱县| 板桥市| 武夷山市| 泗洪县| 贵阳市| 山东省| 大连市| 资阳市| 泰顺县| 哈巴河县| 札达县| 肥乡县| 巫溪县| 呼伦贝尔市| 阿拉善右旗| 大渡口区| 扶风县| 岚皋县| 盘山县| 鹿邑县| 枝江市| 都匀市| 元氏县| 丹阳市| 吴江市| 靖西县| 吴江市| 安新县| 阿尔山市| 香港| 崇州市| 永川市| 祁门县| 鞍山市| 三原县| 广安市| 竹溪县| 塔河县| 博白县| 阳信县|