I have multiple responses which has similar pattern but one key value has always different object in response of json which i want to decode in base model where one key has variety of object type.
Response be like,
{
"status": true,
"message": "Success",
"data":[]
}
Here in data response it has any kind of array of objects or any single object
struct BaseResponseModel: Codable {
var status: Bool
var message: String
var data: DataClass
enum CodingKeys: String, CodingKey {
case message
case data
case status
}
}
what we can do here to make it single class with data type object pass,
Anyone please..!