I want to add custom back button to my app with out losing swipe to back gestures.
Adding this
.navigationBarBackButtonHidden(true)
will remove swipe to back gestures
I tried adding below snippet to the code, it was working but i was able to swipe back on my root view also.
`
extension UINavigationController: UIGestureRecognizerDelegate {
override open func viewDidLoad() {
super.viewDidLoad()
interactivePopGestureRecognizer?.delegate = self
}
public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
return viewControllers.count > 1
}
}
`
I have spent lot of time in finding solution for this.
Please help if you have a solution.