In UIKit, is await detached Task good enough to background some calculations and not block UI?
In a word, I have this ...
func drawCount() {
Task {
await _drawCount()
}
}
func _drawCount() async {
let k = await Task.detached(priority: .low) {
return gfed.filter{$0.blah}.count // the filter takes ~100-500ms
}.value
thing.text = "\(k) units"
}
There are 10 or 20 of the things on the screen; all at once drawCount is called for each of them.
My belief is that all 10 are called; UI is not blocked; the 10 filters will complete at various times (say in the next second or so); as each one is completed, that label or whatever will be written to on UI; and away we go.
Correct or not?