一、Nullability檢測的支持
1. 簡介
2. nullable
// 寫法 1
@property (nonatomic, strong, nullable) NSString * name_1;
// 寫法 2
@property (nonatomic, strong) NSString * __nullable name_2;
// 寫法 3
@property (nonatomic, strong) NSString * _Nullable name_3;
3. nonnull
// 寫法 1
@property (nonatomic, strong, nonnull) NSString * name_1;
// 寫法 2
@property (nonatomic, strong) NSString * __nonnull name_2;
// 寫法 3
@property (nonatomic, strong) NSString * _Nonnull name_3;
注意 : 在 NS_ASSUME_NONNULL_BEGIN 和 NS_ASSUME_NONNULL_END 之間,定義的所有對象和方法默認爲 nonnull
4. null_resettable
@property (nonatomic, strong, null_resettable) NSString * name_1;
注意 : 如果使用 null_resettable ,則必須重寫 getter或setter 方法5. null_unspecified
// 寫法 1
@property (nonatomic, strong) NSString * __null_unspecified name_1;
// 寫法 2
@property (nonatomic, strong) NSString * _Null_unspecified name_2;
二、類型通配符
三、__kindof
__kindof classname *