Created
August 13, 2017 10:53
-
-
Save GregoryMaks/a907cca1532df2583274bc5079f7be07 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 requestTopPosts(completion: @escaping (Result<RedditListingResult<RedditPostServerModel>, RedditError>) -> Void) { | |
let request = URLRequest(url: Constants.topPostsAbsoluteURL) | |
networkService.perform(request: request) { | |
completion( | |
$0.flatMap(ifSuccess: self.verifyServerResponse, ifFailure: self.networkErrorToResult) | |
.flatMap(ifSuccess: self.parsePostModels, ifFailure: liftError) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment