Skip to content

Instantly share code, notes, and snippets.

@pnalvarez
Created March 29, 2020 19:55
Show Gist options
  • Save pnalvarez/fdac93b09371ecd0cbe625e54a7a36f3 to your computer and use it in GitHub Desktop.
Save pnalvarez/fdac93b09371ecd0cbe625e54a7a36f3 to your computer and use it in GitHub Desktop.
protocol PokemonListManagerInput {
func getPokemons(completion: @escaping ([PokemonAPIModel]) -> ())
}
class PokemonListManager: PokemonListManagerInput {
var objects: [PokemonAPIModel] = []
func getPokemons(completion: @escaping ([PokemonAPIModel]) -> ()) {
PokemonAPI.shared.getPokemons {
objects in
self.objects = objects
completion(self.objects)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment