Search code examples
iosobjective-cswiftuiviewcontrollersegue

Cannot go back - popViewControllerAnimated not working, swipe back not working too


I am new to iOS development. I created a segue from one VC to another VC. It is set as "Show(e.g. Push)"

enter image description here

However, swipe back capability is not working. Also, I have a custom back button. I have set a listener to it, which also does nothing:

@IBAction func backClicked(sender: AnyObject)
{
    self.navigationController?.popViewControllerAnimated(true)
}

What is wrong? I want back button to work and swipe back capability to also work. I don't need Navigation Bar.


Solution

  • Just Embed In navigation controller to your root view controller and hide your navigation bar if you don't need it. And your button action will work.