Last active
August 29, 2015 14:02
-
-
Save mxcl/b08815091216920975b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_promise(^{ | |
return md5(email); | |
}).then(^(NSString *md5){ | |
return [NSURLConnection GET:@"http://gravatar.com/%@", md5]; | |
}).then(^(UIImage *gravatarImage){ | |
self.imageView.image = gravatarImage; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_promise{ () -> String in | |
md5(email) | |
}.then{ (md5:String) -> NSURLConnection in | |
NSURLConnection.GET("http://gravatar.com/\(md5)") | |
}.then{ [weak self] (gravatarImage:UIImage) in | |
self?.imageView.image = gravatarImage | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment