Jeff V Jeff V - 6 months ago 26
iOS Question

How to define Objective-C lightweight generic for Array of Arrays of NSNumbers?

I have an object with a property of

NSArray
that contains other
NSArray
s of
NSNumber
s. I've added a lightweight generic to the property definition in the header file like so:

@property (strong, nonatomic, readonly) NSArray<NSArray *> *myArray;


The generated Swift interface shows:

public var myArray: [[AnyObject]] { get }


Is there a way that I can further mark up my property declaration to indicate that this is actually
[[NSNumber]]
? The compiler gets upset with me when I try
NSArray<NSArray *<NSNumber *>> *myArray;
or
NSArray<NSArray *><NSNumber *> *myArray;
.

Answer
@property (strong, nonatomic, readonly) NSArray<NSArray<NSNumber *> *> *myArray;

All the stars have move to the left.