case Grass = "Grass" case Water = "Water" case Fire = "Fire" case Electric = "Electric" } let type1 = PokemonType(rawValue: "Grass") // PokemonType.Grass let type2 = PokemonType(rawValue: "Evil") // nil
= PokemonType(rawValue: "Water") let changedType = type.map { type -> PokemonType in switch type { case .Water: return PokemonType.Electric default: return type } }