Created
April 2, 2013 14:54
-
-
Save simonpang/5292844 to your computer and use it in GitHub Desktop.
Dreaming of promise base event handling v2
This file contains 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
- (id)init | |
{ | |
if (self = [super initNibName:nil bundle:nil]) { | |
[[self whenViewDidLoad] then:^(id result, NSError *error) { | |
[[self.loginButton whenTouchDown] then:^(id result, NSError *error) { | |
[[client login:self.loginField.text password:self.passwordField.text] then:^(id result, NSError *error) { | |
[client saveAccessToken:[result token]]; | |
[self presentModalViewController:[[RegisterViewController alloc] init]]; | |
} fail:^(id result, NSError *error) { | |
[UIAlertView presentError:error]; | |
}]; | |
}]; | |
}]; | |
} | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment