mllm
mllm

Reputation: 17448

Objective C generics in blocks

Despite its name, this question doesn't seem to address it.

Is it possible to use Objective-C generics with blocks?

Something like:

typedef void (^MyResultBlock<__covariant ObjectType>)(NSArray<ObjectType> *items);

...and then declaring a block:

MyResultBlock<NSNumber> blockName = ^void(NSArray<NSNumber> *items) {...};

Upvotes: 6

Views: 1050

Answers (1)

newacct
newacct

Reputation: 122439

No. Objective-C generics are only for classes, not typedefs.

Upvotes: 8

Related Questions