Swift 3.0 in the latter case, we must add "I" along with the class name or it will throw an error " Expected member name or constructor call after type name " below u code can be used for Swift 3 and above
for viewController in viewControllers { if viewController.isKind(of: OurViewController.self){ print("yes it is OurViewController") self.navigationController?.popToViewController(viewController, animated: true) } }
source share