Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class func getTabBarController() -> UITabBarController? {
- let appDelegate = UIApplication.shared.delegate as? AppDelegate
- guard let rootViewController = appDelegate?.window?.rootViewController?.childViewControllers.first as? UITabBarController else { return nil }
- return rootViewController
- }
- private class func navigationControllerFrom(tabBarController: UITabBarController) -> UINavigationController {
- var navigationController: UINavigationController
- if tabBarController.selectedIndex <= tabBarController.childViewControllers.count {
- navigationController = tabBarController.childViewControllers[tabBarController.selectedIndex] as! UINavigationController
- } else {
- navigationController = tabBarController.childViewControllers[0] as! UINavigationController
- }
- return navigationController
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement