how to get root view controller in an application ios swift code example
Example: swift go to root view controller
// For Navigation
self.navigationController?.popToRootViewController(animated: true)
// For Presenting modally
self.view.window!.rootViewController?.dismissViewControllerAnimated(false, completion: nil)