APP開發的乾貨 - 一、使用OC的代碼規範

代碼規範網址:http://www.csdn.net/article/2015-06-01/2824818-objective-c-style-guide
                         https://github.com/VincentSit/NYTimes-Objective-C-Style-Guide-ZH

一、方法的行數不能大於150,controller的文件代碼行數不能大於800

二、#pragma mark 註釋

控制器的註釋

#pragma mark - --- lift cycle 生命週期 ---

#pragma mark - --- delegate 視圖委託 ---

#pragma mark - --- event response 事件相應 ---

#pragma mark - --- private methods 私有方法 ---

#pragma mark - --- getters and setters 屬性 ---

視圖的註釋

#pragma mark - --- init 視圖初始化 ---

#pragma mark - --- delegate 視圖委託 ---

#pragma mark - --- event response 事件相應 ---

#pragma mark - --- private methods 私有方法 ---

#pragma mark - --- setters 屬性 ---

#pragma mark - --- getters 屬性 —

三、屬性註釋的代碼段

@property(nullable, nonatomic, readonly)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, readwrite)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, strong)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, copy)<#Class#> *<#obj#> ; // <##>

@property(nullable, nonatomic, weak)<#Class#> *<#obj#> ; // <##>

@property(readonly, getter=is<#obj#>)BOOL <#obj#> ; // <##>

@property(null_resettable, nonatomic, strong)<#Class#> *<#obj#> ; // <##>

@property(nonatomic)<#Class#> <#obj#> ; // <##>

@property(nonatomic, assign)<#Class#> <#obj#> ; // <##>html

NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_END

四、泛型中的協變和逆變

https://msdn.microsoft.com/zh-cn/library/dd799517.aspx

五、Objective-C 三大新特性

http://www.cocoachina.com/ios/20150617/12148.htmlios

相關文章
相關標籤/搜索