1. Keywords: can be used in attribute methods and return value parameters
Keyword action: Hint function tells developer property information
Purpose of the keyword: to cater to Swift's strong language, Swift must specify whether an object is empty
Keyword Benefits: Improve code planning and reduce communication costs
Just provide a warning and do not report a compilation error
Nullabel effect: Hint may be empty
Syntax 1
@property (Nonatomic, Strong, Nullabel) NSString * name;
Syntax 2
@property (nonatomic, Strong) NSString * _nullabel name;
Syntax 2
@property (nonatomic, Strong) NSString * __nullabel name;
nonnull function: Hint cannot be empty
Syntax 1
@property (Nonatomic, Strong, nonnull) NSString * name;
Syntax 2
@property (nonatomic, Strong) NSString * _nonnull name;
Syntax 2
@property (nonatomic, Strong) NSString * __nonnull name;
null_resettable function: a condition that must be handled as empty get cannot return nil set method can be passed to null
Overriding the Get method
@property (nonatomic, strong,null_resettable) nsstring * name;
You can't use grammar 2 to make an error.
_null_unspecified: Not sure whether it is empty
Rarely used
—————————
!_view change to _view = nil Because Swift does not support the former
Supplement the default between macros (Ns_assume_nonull_begin/end) is nonnull strong
Keyword cannot be used for basic data types
************************************************************************************
2. Generics
Why quit generics? cater to Swift
Generic benefits: 1. Restriction type 2. Improve code specifications reduce communication costs
Generic usage: Type < restriction type >
Generics are just news alerts
Generic benefits are removed from the array to use point syntax
Hints for adding elements to an array
Usage scenarios for generics in development: 1. To restrict collection types
The distinction and use of nullable,nonnull, null_resettable and _null_unspecified