Last active
August 29, 2015 14:03
-
-
Save kyleclegg/458622a8bd5a1005fb3f to your computer and use it in GitHub Desktop.
Code sample taken from http://www.techsfo.com/blog/2013/08/managing-nested-asynchronous-callbacks-in-objective-c-using-reactive-cocoa/. signalGetNetworkStep makes an async call to an endpoint.
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
__weak id weakSelf = self; | |
[[[[[self signalGetNetworkStep1] flattenMap:^RACStream*(id *x) { | |
// perform your custom business logic | |
return [weakSelf signalGetNetworkStep2:x]; | |
}] flattenMap:^RACStream*(id *y) { | |
// perform additional business logic | |
return [weakSelf signalGetNetworkStep3:y]; | |
}] flattenMap:^RACStream*(id *z) { | |
// more business logic | |
return [weakSelf signalGetNetworkStep4:z]; | |
}] subscribeNext:^(id*w) { | |
// last business logic | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment