Last active
July 31, 2018 17:31
-
-
Save Viniciuscarvalho/93d996246c17b48bd74260215167a742 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| struct ListGamesUseCase { | |
| private let listGamesPresenter: ListGamesPresenter | |
| private let gamesGateway: GamesGateway | |
| init(listGamesPresenter: ListGamesPresenter, gamesGateway: GamesGateway) { | |
| self.listGamesPresenter = listGamesPresenter | |
| self.gamesGateway = gamesGateway | |
| } | |
| func list() { | |
| gamesGateway.allGames().onResult { result in | |
| switch result { | |
| case .success(let games): self.listGamesPresenter.list(games: games) | |
| case .fail(let error): self.listGamesPresenter.show(error: error) | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment