ios9以后的新增关键字

1、nonnull 不可以为空

书写格式:

@property (nonatomic, strong, nonnull) NSString *icon;

@prepertu (nonatomic, strong)NSString *_Nonnull icon;

@prepertu (nonatomic, strong)NSString *__nonnull icon;


2、nullable 可以为空

@property (nonatomic, strong, nonable) NSString *icon;

@prepertu (nonatomic, strong)NSString *_Nonable icon;

@prepertu (nonatomic, strong)NSString *__nonable icon;

3、null_resettable get方法不能为空,set方法可以为空

该方法想到控制器的View(控制器View不为空)

内部实现原理:

- (UIView *)view

{

         if(_view == nil){

                [self loadView];

                [self viewDidLoad];

          }

}

4、_Null_unspecified 不确定是否为空

@prepertu (nonatomic, strong)NSString *_Null_unspecified name;

@prepertu (nonatomic, strong)NSString *__null_unspecified name;

你可能感兴趣的:(ios9以后的新增关键字)