You can enhance your own classes with generics just like NSArray or NSDictionary.
NSArray
NSDictionary
@interface MyClass<__covariant T> @property (nonnull, nonatomic, strong, readonly) NSArray<T>* allObjects; - (void) addObject:(nonnull T)obj; @end