I have created a model and I need to try to add value to one of the CodingKey's case
struct Model {
let name: String
let location: String
let descriptions: String
}
enum CodingKeys: String, CodingKey {
case name = "NAME"
case location = "LOCATION"
case descriptions = "INFO-\(NSLocalizedString("Language", comment: ""))"
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
.
.
descriptions = try container.decode(String.self, forKey: .descriptions)
}
Now compiler gives me this error
🛑 Raw value for enum case must be a literal
How can I fix this error?
[String:String]and select the required value