I'm trying to show a ProgressView while something is being processed, and the app busy.
in this exemple during the for
import SwiftUI
struct ContentView: View {
@State var isLoading:Bool = false
var body: some View {
ZStack{
if self.isLoading {
ProgressView()
.zIndex(1)
}
Button("New View"){
self.isLoading = true
var x = 0
for a in 0...5000000{
x += a
}
self.isLoading = false
print("The End: \(x)")
}
.zIndex(0)
}
}
}
In my app the ProgressView don't appears when i Press the button
So how I can display the ProgressView while the for is running?
I'm using Xcode 12