I have a view with structure like this:
struct ContentView: View {
@ObservedObject private var viewModel = MyViewModel()
var body: some View {
ZStack {
VStack {
// Several buttons and input forms
}
// the viewModel has published states.
switch viewModel.state {
case .loading:
ProgressView()
case .finish:
// ...
case .error:
// ...
}
}
}
}
What I want to achieve is to simply avoid user interacting with any other components if the ProgressView appeared, but couldn't find a good way...