Skip to content

Instantly share code, notes, and snippets.

@syshen
Created March 4, 2015 14:56
Show Gist options
  • Select an option

  • Save syshen/692398f5dd5e4cc484a1 to your computer and use it in GitHub Desktop.

Select an option

Save syshen/692398f5dd5e4cc484a1 to your computer and use it in GitHub Desktop.
[[self.viewModel.refreshCommand.executing deliverOnMainThread] subscribeNext:^(id executing) {
if ([executing boolValue]) {
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeGradient];
} else {
[SVProgressHUD dismiss];
}
}];
@weakify(self);
[[self.viewModel.refreshCommand.errors deliverOnMainThread] subscribeNext:^(NSError *error) {
[SVProgressHUD dismiss];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Something wrong! >_<" delegate:nil cancelButtonTitle:@"Retry" otherButtonTitles:nil];
[[alert rac_buttonClickedSignal] subscribeNext:^(id x) {
@strongify(self);
[self reload];
}];
[alert show];
}];
[[[self.viewModel.refreshCommand.executionSignals flatten] deliverOnMainThread]
subscribeNext:^(NSArray *response) {
// Create StoryViewModel here
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment