I'm trying to parse the following structure using Codable:
{
type: "type" // or eg: movie, serie, short, feature
info: { /* structure and depending on type*/ }
state: { /* structure and data depending on type */}
}
Basically, it's a variant type where the data in info
and state
depend on the type
field. What would be the best approach to model this in Swift by making use of Codable?