Skip to content

Instantly share code, notes, and snippets.

@jdewind
Created December 5, 2014 16:05
Show Gist options
  • Save jdewind/4749c7039d389d62603d to your computer and use it in GitHub Desktop.
Save jdewind/4749c7039d389d62603d to your computer and use it in GitHub Desktop.
- (instancetype)fetchPerson:(NSInteger)personId {
[[self fetchAtEndPoint: [NSString stringWithFormat: @"/person/%d", personId], mapTo: [Person class]] flattenMap: ^(id person) {
if(!person) {
return [RACSignal error: nil];
} else {
return [RACSignal return: person];
}
}];
}
- (instancetype)fetchAtEndPoint: (NSString *)relativePath mapTo: (Class)theClass {
// Implementation details...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment