The nullability attribute is used to indicate whether the pointer can be nil, and the intent of the API can be expressed more clearly by this feature.
At the same time, the compiler nullability the code at compile time, prompting the necessary warnings.
To be added to Ns_assume_nonnull_begin when using ... Between Ns_assume_nonnull_end
Object pointers: Nullable nonnull
C-pointer: __nonnull __nullable __null_unspecified
Null_resettable is used in attributes, the setter method that represents the property can be set to the Nil,getter method and does not return nil
Lightweight is because this is a pure compiler syntax support (LLVM 7.0), like nullability, without any OBJC runtime upgrades, that is, this new syntax can be used on Xcode 7 and fully backwards compatible (lower IOS version)
Mainly used in Nsarray and nsdictionary containers.
An array object that holds only the string object:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7C/7E/wKioL1bRn4ijVQEjAAB4X-xuiyA648.png "title=" screen shot 2016-02-27 pm 9.05.04.png "width=" 598 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:598px;height:80px; " alt= "Wkiol1brn4ijvqejaab4x-xuiya648.png"/>
A Dictionary object that only exists for numeric objects:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7C/7F/wKiom1bRnzuTsm1OAAFmkZMcwFw516.png "title=" screen shot 2016-02-27 pm 9.05.42.png "width=" 598 "height=" 107 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:598PX;HEIGHT:107PX; " alt= "Wkiom1brnzutsm1oaafmkzmcwfw516.png"/>
To customize a container that supports generics:
@interface Stack <StackType>: nsobject-(void) Pushobject: (Stacktype) obj;-(stacktype) popobject; @end
Such as:
__kindof Amperson * p;
Object used to indicate that the pointer is storing a Amperson object or a Amperson subclass
Resolves problems with poor readability before using ID types, and adds legitimacy validation
This article is from the "Teacheran" blog, make sure to keep this source http://annmeng.blog.51cto.com/3321237/1745638
Objective-c (XCODE7) new features