So my idea, is to once is retrieved from the API, that they are shown alphabatecally by the value 'name' of the Charact object which are all them stored in to pokemons array.
I would like to know how i would be able to sort my list of Pokemons so they appear in alphabetical order
Here is my Object code:
class Charact: Codable {
var id: Int?
var isDefault: Bool?
var isMega : Bool?
var isBattleOnly : Bool?
var name: String?
var sprites: Sprite?
private enum CodingKeys: String, CodingKey {
case isDefault = "is_default"
case isMega = "is_mega"
case isBattleOnly = "is_battle_only"
case id
case name
case sprites
}
}
Here is the code : Code in paste-bin