I have 3 view controllers: VC1 -> VC3 -> VC2. Transit from VC3 to VC2 I made by next code:
let storyboard = UIStoryboard(name: "VCs", bundle: nil)
let myVC2 = storyboard.instantiateViewController(withIdentifier: "VC2") as? VC2
myVC2?.name = "Test"
self.navigationController?.pushViewController(myVC2!, animated: true)
In viewDidLoad()
of VC2 I delete VC3 from viewControllers stack and left only VC1:
var navigationVCs = self.navigationController?.viewControllers
navigationVCs!.remove(at: 1)
self.navigationController?.viewControllers = navigationVCs!
All work well. But I have one visual "Issue". When the view controller moves from VC4 to VC3, and VC3 view starts a load, NavigationBar back button of VC3 first of all show title of VC4, and only then switches to VC1 title. How I can fix this and force VC2 show back button title of VC1? Thanks.