'SwiftUI Foreach OutOfMemory / OutOfRange
I have some problem with making a loop in Swift/SwiftUI.
--Result bad performance and not release memory = OutOfMemory
ForEach(model.model) { item in
Text(item.name)
}
--Result OutOfRange because of model is updated in background
ForEach(model.model.indices) { i in
Text(model.model[i].name)
}
--Result bad performance and not release memory = OutOfMemory
ForEach($model.model) { $item in
Text($item.wrappedValue.name)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
