I am trying to make my enumeration that has different associated values comply to the Decodable protocol, but am having trouble with the associated values part.
enum SportType: Decodable {
case team(String, String) //Two team names
case individual([String]) //List of player names
}
I have successfully gotten an enum to conform to Decodable without associated values, but am having trouble doing the same thing with the associated values.
//Works but no associated values
enum SportType: String, Decodable {
case team, case individual
}