Skip to content

Instantly share code, notes, and snippets.

@notxcain
Last active December 30, 2015 08:39
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 notxcain/7803873 to your computer and use it in GitHub Desktop.
Save notxcain/7803873 to your computer and use it in GitHub Desktop.
Разница
- (void)updateWithCompletion:(void (^)(BOOL success, NSError *))completion
{
[API executeRequest:request completion:^(id result, NSError *error) {
if (!result) {
completion(NO, error);
return;
}
[Importer importFromResult:result completion:^(BOOL result, NSError *error) {
if (!result) {
completion(NO, error);
return;
}
completion(YES, nil);
}];
}];
}
// Превращается в
- (RACSignal *)update
{
return [[[API executeRequest:request] map:^(id result) {
return [Importer importFromResult:result];
}] switchToLatest]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment