Created
January 8, 2016 10:25
-
-
Save RuiAAPeres/ea2d752dbeb4f30c0e86 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
func fetchData(request: NSURLRequest) -> SignalProducer<[Foo], Error> { | |
return foosFromServer(request).flatMapError {_ in //network failed deal with it} | |
.flatMapLatest { parseFoos($0).flatMapError {_ in //parse failed deal with it} } | |
.flatMapLatest { persistFoos($0).flatMapError {_ in //persist failed deal with it} } | |
.flatMapError { error in loadFoosFromCache().mapError {_ in error} } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment