1

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?

enter image description here

Timmy
  • 4,098
  • 2
  • 14
  • 34
Legolas Wang
  • 1,951
  • 1
  • 13
  • 26
  • Why use a padding on the `NavigationStack`? Maybe you can achieve your expectation using a different way. – Timmy Nov 14 '22 at 07:56
  • @Timmy Sadly, the NavigationView is SubView of the app to fit the overall look. I need to figure out a way to extend the gesture area of the navigation to include the padding area. – Legolas Wang Nov 14 '22 at 08:35

0 Answers0