Skip to content

Instantly share code, notes, and snippets.

@jparise
Created September 24, 2012 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jparise/3778366 to your computer and use it in GitHub Desktop.
Save jparise/3778366 to your computer and use it in GitHub Desktop.
-arrayByApplyingBlock:
- (NSArray *)arrayByApplyingBlock:(id (^)(id obj))block {
NSParameterAssert(block != nil);
NSMutableArray *result = [NSMutableArray arrayWithCapacity:self.count];
for (id obj in self) {
[result addObject:block(obj)];
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment