Skip to content

Instantly share code, notes, and snippets.

@hasanadil
Created August 14, 2015 17:20
Show Gist options
  • Save hasanadil/6cd7f2a4d0f9dd89123b to your computer and use it in GitHub Desktop.
Save hasanadil/6cd7f2a4d0f9dd89123b to your computer and use it in GitHub Desktop.
-(void) fetchDominantColorFromImage:(NSImage*)image withCompletion:(void(^)(NSColor *color, NSTimeInterval processingTime))completion {
...
__weak typeof(self) weakMe = self;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
[weakMe pixelsFromImage:image withCompletion:^(UInt32 *pixels, NSUInteger pixelCount) {
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment