Skip to content

Instantly share code, notes, and snippets.

@Viniciuscarvalho
Last active July 31, 2018 17:31
Show Gist options
  • Select an option

  • Save Viniciuscarvalho/93d996246c17b48bd74260215167a742 to your computer and use it in GitHub Desktop.

Select an option

Save Viniciuscarvalho/93d996246c17b48bd74260215167a742 to your computer and use it in GitHub Desktop.
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