Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#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])
options:options
usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclRange, BOOL *stop)
{
dispatch_group_async(group, dispatch_get_global_queue(0, 0), ^ {
block(substring);
});
}];
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.