@Model
class modelData {
var property1 : String = ""
init(property1: string){
...
}
}
for item in arrayOfManyStrings {
let instanceOfModelData = modelData(property1: item)
}
Trying to create multiple instances of my modelData. I expect the loop to run and create instanceOfModelData
30k times. However it is far too slow. 30-90 seconds depending on device.
If I remove the @Model
macro, the same loop take < 5 seconds.
I obviously need the @Model
for swiftData.
How to speed up creating instances of instanceOfModelData
when using @Model