1.nollable
nollable:作用:可能為空。 可以用于屬性,方法返回值和參數中
作用:提示作用,告訴開發者屬性信息
關鍵字的目的:迎合swfit 是個強語言 ,swfit必須要指定一個對象是否為空
關鍵字的好處;提高代碼的規范,減少溝通的成本
nonnull語法1:
@property (nonatomic,strong,nullable) NSString * name;
nonnull 語法2。* 關鍵字 變量名
@property (nonatomic, strong)NSString * _Nullablenames;
nonnull語法3
@property (nonatomic, strong)NSString * __nullablenames;
2.nonnull:
作用:不能為空
關鍵字:僅僅提供一個警告,并不會報錯。語法同上。
3.null_resettable:
作用: get方法不能返回nill set 可以傳入為空必須要處理為空的方法(重寫get方法)
語法:
@property (nonatomic,strong,null_resettable) NSString * name;
4._Null_unspecified
作用:不確定是否為空