I'm using SwiftUI's NavigationStack
. When NavigationStack
has a .padding()
, the swipe back gesture no longer works. My best guess is that the gesture has to be triggered from the edge of the screen. And with padding, it cannot trigger.
NavigationStack {
List(1..<50) { i in
NavigationLink(value: i) {
Label("Row \(i)", systemImage: "\(i).circle")
}
}
.navigationDestination(for: Int.self) { i in
Text("Detail \(i)")
}
.toolbar(.hidden, for: .navigationBar)
}
.padding()
For example, like the image below, you can no longer swipe back from detail view.
How could I keep the swipe back gesture, while having a .padding
on a NavigationStack
?