I found a strange and frustrating behavior in SwiftUI. If you present a sheet from within a view in a navigation link and then (quickly and in order):
swipe down to dismiss the sheet
swipe back (from left edge to the right) to dismiss the navigation view
The app will freeze before going back to the root view. Backgrounding the app and foregrounding it will unstick it.
You have to perform the steps very quickly. Is there a workaround? I would like both gestures to work without interfering with each other.
This code will reproduce the issue:
struct ContentView: View {
@State var showSheet = false
var body: some View {
NavigationView {
VStack {
NavigationLink("blah") {
VStack {
Button("Show Sheet") {
showSheet.toggle()
}
.sheet(isPresented: $showSheet, onDismiss: nil) {
Text("Sheet")
}
}
}
}
}
}
}
There is a gif linked in the Stack Overflow question demonstrating the problem.