Default for detail Screen UIViewController (swipe / click back button) its goes its previous controller, i.e., its RootviewController
When added custom back button to detail UIViewController swipe stop working, only click back button works.
why its like that? how to enable the swipe option too for navigating its previous controller.
CustomViewController
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.navigationItem.leftBarButtonItem = UIBarButtonItem.menuButton(self, action: #selector(backButtonPressed), imageName: "backArrow")
}
@objc func backButtonPressed() {
// self.navigationController?.popToRootViewController(animated: true)
navigationController?.popViewController(animated: true)
}
DetailViewController
class DetailViewController: CustomViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}