Relative Content

Tag Archive for iosswiftswiftuiswiftdataswiftdata-migrations

SwiftData: adding a UUID to an existing model always creates the same id

I have a problem updating a SwiftData model by adding a property.
Specifically, I have the following model and I am trying to update it by adding an id. The problem is that, if I do this, all records already stored in the app get updated with the same UUID. Obviously I would like to have a different id for every instance. Am I missing something? Should I do something differently?