In the following simple example you will find that the first time you tap Toggle Loading the ProgressView is shown as it should, but the second time (3rd tap) it's not.
It seems to be caused by the surrounding List.
Any ideas what the issue is and how to make it work?
struct ContentView: View {
@State private var isLoading = false
var body: some View {
List {
if isLoading {
HStack(alignment: .center, spacing: 10) {
ProgressView()
Text("Loading")
}
} else {
Text("Not Loading")
}
Button("Toggle Loading") {
isLoading.toggle()
}
}
}
}
struct ContentView: View {
@State private var isLoading = false
var body: some View {
List {
HStack(alignment: .center, spacing: 10) {
if isLoading {
ProgressView()
}
Text(isLoading ? "Loading" : "Not Loading")
}
Button("Toggle Loading") {
isLoading.toggle()
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With