Skip to content

Instantly share code, notes, and snippets.

@pnalvarez
Created March 29, 2020 18:51
Show Gist options
  • Save pnalvarez/4f0377f8efea03fb244509d4670a80da to your computer and use it in GitHub Desktop.
Save pnalvarez/4f0377f8efea03fb244509d4670a80da to your computer and use it in GitHub Desktop.
Illustrating Pokemon Mapper
static func parse(from details: PokemonDetailsEntity) -> PokemonDetailsViewModel {
var typeString = ""
for type in details.types {
typeString.append(contentsOf: "\(type) ")
}
return PokemonDetailsViewModel(name: details.name, info: " order: \(details.order)\n weight: \(details.weight)\n height: \(details.height)\n base experience: \(details.baseExperience)", id: details.id, image: URL(string: details.image) , types: typeString, mainMove: details.mainMove)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment