////VIEWCONTROLLER.M//Common keywords for new features of 01-ios9////Created by Kun on 16/8/16.//copyright©2016 year Kun. All rights reserved.///*nullable:1, how to use (grammar) 2, when to use (function) nullable effect: possible for empty keyword purpose: To cater to Swift,swift is a strong language, Swift must specify whether an object is NULL keyword benefit: Improve code specification, Reduce communication costs Nullable Syntax 1 @property (nonatomic, Strong, nullable) NSString *name; Nullable Syntax 2 @property (nonatomic, strong) NSString *_nullable name; Nullable Syntax 3 @property (nonatomic, strong) NSString *__nullable name; *//*nonnull:1, how to use (grammar) 2, when to use (function) nonnull function: cannot be null nonnull Syntax 1 @property (nonatomic, Strong, nonnull) NSString *name; non Null Syntax 2 @property (nonatomic, strong) NSString *_nonnull name; nonnull Syntax 3 @property (nonatomic, strong) NSString *__nonnull name; Null_resettable nonnull*//*null_resettable:1, how to use (syntax) 2, when to use (function) Null_resettable: An empty condition must be handled, overriding the Get method null_resettable function: The Get method cannot be empty, Set can be passed in as null keyword Objective: To cater to Swift,swift is a strong language, Swift must specify whether an object is NULL keyword benefit: Improve code specification, reduce communication cost Syntax 1 @property (nonatomic, Strong, Null_ resettable) NSString *name; *//*_null_unspecified: Not sure whether it is empty*//*The properties between the following two macros default to nonnull ns_assume_nonnull_begin ns_assume_nonnull_end*/#import "ViewController.h"@interfaceViewcontroller ()//Nullable//nonnull//null_resettable processing for empty conditions@property (Nonatomic, Strong, null_resettable) NSString *name;//@property (nonatomic, strong) NSString *_nullable name;//@property (nonatomic, strong) NSString *__nullable name;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; }-(NSString *) name{if(_name = =Nil) {_name=@""; } return_name;}- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}@end
Keywords for new features of IOS9