So I have a struct that is Codable ( or was )
struct Person {
let name: String //<-- Fine
let age: Int //<-- Fine
let location: String //<-- Fine
let character: Character. //<-- Here comes the error (Type Person does not conform to Decodable)
}
enum Character {
case nice, rude
}
Now I understand the error. Every type except the enum is Codable so I'm good up until that point. Now as a way to solve this.. I was pretty sure this would work ..
extension Person {
private enum CodingKeys: CodingKey { case name, age, location }
}
But even after telling Swift the properties I want to be decoded I still get this error? Puzzled.
enum Character: String, Codable