#import "ViewController.h" @interface ViewController () @property(nonatomic,nullable)NSString*name;//可以为空 @property(nonatomic,nonnull)NSString*password;//不可为空 @property(nonatomic,null_unspecified)NSString*unkonw;//未知类型 @property(nonatomic)NSString* _Nullable name1;//可以为空 @property(nonatomic)NSString* _Nonnull password1;//不可为空 @property(nonatomic)NSString* _Null_unspecified unkonw1;//未知类型 @property(nonatomic)NSString* __nullable name2;//可以为空 @property(nonatomic)NSString* __nonnull password2;//不可为空 @property(nonatomic)NSString* __null_unspecified unkonw2;//未知类型 @property(nonatomic,null_resettable)NSString*setStr;//get方法不能为空,set方法可以为空 -(void)creatDemoWithName:(nullable NSString*)name PSW:( NSString* _Nonnull )psw UnkonwStr:(null_unspecified NSString*)unkownStr; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self creatDemoWithName:nil PSW:@"heheheh" UnkonwStr:nil]; } -(void)setSetStr:(NSString *)setStr{ self.setStr = @"hehehe"; } -(void)creatDemoWithName:(nullable NSString*)name PSW:( NSString* _Nonnull )psw UnkonwStr:(null_unspecified NSString*)unkownStr{ NSLog(@"%@=%@=%@",name,psw,unkownStr); }