Generic “Functions” in Objective-C
Since the only way to declare generic parameters and return values is through a class interface, we’ll wrap our map method in a new class[…]
[…]
AHKArrayMapper’s
only method takes an array ofInputType
objects and a block mapping fromInputType
toOutputType
. It returns an array ofOutputType
objects. The implementation doesn’t really differ from the one without generics, because generics aren’t available in implementation files[…]
Objective-C generics are useful for interfacing with Swift and for documenting APIs. I’m not sure that it really makes sense to code with them this way.