1, define,

@interface ZFObject<__covariant ObjectType> : NSObject

– (void)addObject:(ObjectType)obj;

@end

A subtype of a __covariant stereotype to a larger type (the parent type of the stereotype class)

__contravariant From large type to small type

2, use,

ZFObject <NSObject *>*obj = [[ZFObject alloc]init];

NS_ASSUME_NONNULL_BEGIN Defines that all attributes cannot be empty

@interface ViewController ()

@property (nonatomic, strong, nullable) NSArray *dataSource; ///<

//@property (nonatomic, strong, null_resettable) NSArray *datas; ///< null_resettable set can be null

@end

}

NS_ASSUME_NONNULL_END