As part of an API response for a particular object we receive the following:
"itemNotes" : {
"disclaimer" : "some text here"
},
However, itemCaptions
can contain an indeterminate number and range of values, each with type [String: String]
.
So within my data model I am setting this up as follows:
struct Item: Codable, Equatable, Identifiable, Hashable {
...
let itemNotes: [String: String]?
...
}
This works fine, except that I need to be able to store instances of this model in core data but I am unsure how to go about this. I already have an Item
entity but how can I set up a relationship to represent a dictionary item whose key could be anything?