Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. private class func getTabBarController() -> UITabBarController? {
  2. let appDelegate = UIApplication.shared.delegate as? AppDelegate
  3. guard let rootViewController = appDelegate?.window?.rootViewController?.childViewControllers.first as? UITabBarController else { return nil }
  4. return rootViewController
  5. }
  6.  
  7. private class func navigationControllerFrom(tabBarController: UITabBarController) -> UINavigationController {
  8. var navigationController: UINavigationController
  9. if tabBarController.selectedIndex <= tabBarController.childViewControllers.count {
  10. navigationController = tabBarController.childViewControllers[tabBarController.selectedIndex] as! UINavigationController
  11. } else {
  12. navigationController = tabBarController.childViewControllers[0] as! UINavigationController
  13. }
  14. return navigationController
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement