Skip to content

Instantly share code, notes, and snippets.

@bvanderveen
Created June 25, 2013 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvanderveen/5863493 to your computer and use it in GitHub Desktop.
Save bvanderveen/5863493 to your computer and use it in GitHub Desktop.
// view model
self.figureOutWhatToShowNext = [RACCommand commandWithCanExecuteSignal:self.okayToShowNextThing];
self.nextVM = [[self.figureOutWhatToShowNext addSignalBlock:^ RACSignal *(id value) {
return [self.model.figureItOut map:id (id x) { return x.boolValue ? [[OkayVM alloc] init] : [[NotOkayVM alloc] init] }];
] flatten];
// view
someButton.rac_command = vm.figureOutWhatToShowNext;
[vm.nextVM subscribeNext:^ (id vm) {
UIViewController *vc = makeVCFromVMSomehow(vm);
[self.navigationController presentViewController:vc animated:YES];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment