1

I have three UIViewControllers where A -> B -> C, and A -> D.

When the user is done in C I want to unwind back to A and then segue to D, but I cannot get this to work without briefly showing A before the segue to D happens. I have tried disabling the animates property for the segue but A still flashes into view for less than a second.

Any idea as to how I can fix this?

Developer
  • 736
  • 7
  • 30

1 Answers1

3

Try this Code in swift 3 :-

let oldVCs = self.navigationController?.viewControllers
var newVCs = [UIViewController]()

// Add your root VC in new array of VCs
newVCs.append(oldVCs![0])
// Add your new VC just after your root VC
newVCs.append("Your New VC")

self.navigationController?.setViewControllers(newVCs, animated: true)
Amit
  • 4,837
  • 5
  • 31
  • 46