I have a @Model
class like so:
@Model
final class MyModel {
@Attribute(.unique) var id: String
var object1: Object1
var object2: [Object2]
init(...) {}
}
Object1
and Object2
are both structs
like so:
struct Object1: Codable {
...
var description: String
...
}
I’ve noticed that I get an error when trying to use the model
Unable to have an Attribute named description
After some digging I came to the conclusion that the error is due to the description
fields of Object1
and Object2
. However I need those two structs
to contain that specific field, because they represent incoming JSON-Data. How can I resolve that issue in the optimal way?
Bonus Question: Why is that even a problem for SwiftData since MyModel
has no field called description
.