Let's say I have NSArray *x = @[@1, @2, @3, @4];
Now say I need an array like @[@2, @4, @6, @8]
In a good ole Swift, I can just do:
xDoubled = x.map({($0) * 2})
Can someone tell me how I can do this in Objective-C without execution -
NSMutableArray *xDoubled = [NSMutableArray new]; for (NSInteger xVal in x) { [xDoubled addObject:xVal * 2]; }
?
source share