Skip to content

Instantly share code, notes, and snippets.

@Kievkao
Created March 30, 2016 17:02
Show Gist options
  • Select an option

  • Save Kievkao/1da6f2b33fe8c9f728e8ea9a2cead787 to your computer and use it in GitHub Desktop.

Select an option

Save Kievkao/1da6f2b33fe8c9f728e8ea9a2cead787 to your computer and use it in GitHub Desktop.
- (NSArray *)arrayFromObjectsCollectedWithBlock:(id(^)(id object))block
{
__block NSMutableArray *collection = [NSMutableArray arrayWithCapacity:[self count]];
[self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[collection addObject:block(obj)];
}];
return collection;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment