Objective-C Language Classes and Objects Specifying Generics


Example

You can enhance your own classes with generics just like NSArray or NSDictionary.

@interface MyClass<__covariant T>

@property (nonnull, nonatomic, strong, readonly) NSArray<T>* allObjects;

- (void) addObject:(nonnull T)obj;

@end