0

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.