Dismissing presented view controller returns to root view of navigation controller

195 views Asked by At

I have a UINavigationController that has a stack of view controllers. Something like below:

    [RestListViewController, RestViewController, ProdListViewController]

ProdListViewController presents another view controller ProdViewController.

When I call

    self.dismiss(animated: true, completion: nil)

I am returned the the RestListViewController

I understand this is because the UINavigationController is released when the view controller is presented, therefore is reloaded.

Is there any way I can stop this happening and have the dismiss function return to the original vc stack? Edit: ProdViewController is presented as so

let productViewController = ProdViewController()
self.present(productViewController, animated: true, completion: nil)

and dismissed

self.dismiss(animated: true, completion: nil)
0

There are 0 answers