Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#import "NSString+ConcurrentEnumeration.h"
@implementation NSString (ConcurrentLineEnumeration)
- (void)enumerateConcurrentlyWithOptions:(NSStringEnumerationOptions)options
usingBlock:(void (^)(NSString *substring))block
dispatch_group_t group = dispatch_group_create();
[self enumerateSubstringsInRange:NSMakeRange(0, [self length])
usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclRange, BOOL *stop)
dispatch_group_async(group, dispatch_get_global_queue(0, 0), ^ {
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment