I am trying to use Codeable for the following response from the API
{
"id": "1",
"name": "Demo 1",
"description": "Description 1",
"created": "2020-04-12T17:20:32.687628Z",
"creator": {
"id": 10,
"name": "My User",
"image": null
},
"images": [],
"allergens": []
}
This is my code
struct MyObject: Codable {
let id: Int
let name, description, created: String
let images, allergens: [String]
let creator: [String: Any]?
}
I want have Codable struct for my example API object. I have another object in main object. How can I solve this problem in Swift with struct and Codable?