I have two view controllers. I have navigated from one view to another view by press the button to using below code.
*let secondViewController = self.storyb
For swift 4 you can use
if let viewControllers = self.navigationController?.viewControllers { for vc in viewControllers { if vc.isKind(of: YourViewController.classForCoder()) { print("It is in stack") //Your Process } } }