NSArray. How do I implement the Map function?

ios, mapreduce, nsarray, objective-c

Solution

You can use `enumerateObjectsUsingBlock:` function of `NSArray`.

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

Problem

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

Original source