I am checking if there is or not internet connection before calling any service method. If there's no internet, I am showing an alert and if I click ok button I want to go to root view controller.
Here's my code:
if TLReachability.isConnectedToNetwork() == true{
// do here
}
else {
let navigationController = UIApplication.sharedApplication().keyWindow?.rootViewController as! UINavigationController
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let changeViewController = mainStoryboard.instantiateViewControllerWithIdentifier("TLLoginViewController") as! TLLoginViewController
navigationController.presentViewController(changeViewController, animated: true, completion: nil)
}