iOS9新特性關鍵字:能夠用於屬性、方法返回值和參數中swift
關鍵字的做用:提示做用,告訴開發者屬性信息atom
關鍵字的目的:迎合swift,swift是個強語言,swift必需要指定一個對象是否爲空對象
關鍵字的好處:提升代碼規劃,減小溝通成本開發
關鍵字使用錯誤僅僅報一個警告,並不會編譯錯誤get
nullable:1.怎麼使用(語法)2.何時使用(做用)編譯
nullable的做用:可能爲空table
nullable 語法1變量
@property (nonatomic, strong nullable) NSString *name;語法
nullable 語法2 *關鍵字 變量名方法
@property (nonatomic, strong)NSString * _Nullable name;
nullable 語法3
@propert (noantomic, strong) NSString *_nullable name;
nonnull 不能爲空;語法同上。
null_resettable:1.怎麼使用(語法)2.何時使用(做用)
必需要處理爲空狀況,重寫Get方法
null_resettable的做用:get方法不能返回nil set方法能夠傳入爲空
null_resettable 語法
@property (nonatomic, strong ,null_resettable) NSString *name;