I have a List
with a ProgressView
and some rows. When I scroll the List
down and up again, the ProgressView
get hidden, I notice this bug only with a certain number of rows, for example on iPhone 13 you can reproduce this bug if you have 20 rows.
struct ContentView: View {
var body: some View {
List {
ProgressView()
ForEach(0..<20, id: .self) {
Text("($0)")
}
}
}
}
2
Answers
I know that it’s probably too late. But I also had this problem and figured it might be caused by SwiftUI "recovering" your previously used view that (for some reason) it’s now hidden.
So what I did to fix this was just adding a unique ID to my progress view, this way SwiftUI won’t try to re-utilize it.
Ex:
okay, so first thing first, thank you EdYuTo for giving a correct answer. The reasoning is also correct, we are reusing "cells" to save memory.
Alternatively we could use SwiftUI.Section{} to solve this missing progressView() issue. You would basically need to put the progressView() inside the Section.