Last active
December 30, 2015 08:39
-
-
Save notxcain/7803873 to your computer and use it in GitHub Desktop.
Разница
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
- (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