NSArray. How to implement the Map function?

advertisements

In iOS I want to implement the map function for NSArray. This is a function that is applied to every element of the array. What is the best way to implement this?

Thanks,
Doug


You can use enumerateObjectsUsingBlock: function of NSArray.

[myArray enumerateObjectsUsingBlock:^(id x, NSUInteger index, BOOL *stop) {
    // Body of the function
}];