Skip to content

Instantly share code, notes, and snippets.

@Denismih
Last active May 30, 2019 07:08
Show Gist options
  • Save Denismih/f7e5853ccd51d6a79c94553997606e46 to your computer and use it in GitHub Desktop.
Save Denismih/f7e5853ccd51d6a79c94553997606e46 to your computer and use it in GitHub Desktop.
class private func instantiateJobDetailsViewController(job: JobModel) {
if let tabBarController = UIApplication.sharedApplication().delegate?.window??.rootViewController as? UITabBarController {
tabBarController.selectedIndex = 0
let currentNavigationController = tabBarController.selectedViewController as! UINavigationController
let currentViewController = currentNavigationController.topViewController!
currentViewController.performSegueWithIdentifier("JobDetailSegue", sender: job)
} else {
ClientHelper.displayAlertAsync("Error", message: "Info for support: cannot present jobDetails view controller", controller: nil)
}
}
let pollViewController = PollViewController(urlString: url.absoluteString, appName: appName!)
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.window?.rootViewController = nil
let tabBarRootController = UIStoryboard(name: "Main", bundle: Bundle.main)
appDelegate.window?.rootViewController = tabBarRootController.instantiateInitialViewController()
appDelegate.window!.makeKeyAndVisible()
if let tabBarController = appDelegate.window?.rootViewController as? UITabBarController {
//tabBarController.selectedIndex = 0
let currentNavigationController = tabBarController.selectedViewController as! UINavigationController
let currentViewController = currentNavigationController.topViewController!
currentViewController.navigationController?.pushViewController(pollViewController, animated: true)
} else {
print( "Info for support: cannot present jobDetails view controller")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment