Skip to content

Instantly share code, notes, and snippets.

@jbarros35
Created October 31, 2019 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbarros35/b57cfe037227eb948c0ad6c80c1aefee to your computer and use it in GitHub Desktop.
Save jbarros35/b57cfe037227eb948c0ad6c80c1aefee to your computer and use it in GitHub Desktop.
setup DrawerController with a UITabBar
DispatchQueue.main.async {
// Init Drawer
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let storyBoard = UIStoryboard.init(name: "Main", bundle: Bundle.main)
let navVC = storyBoard.instantiateViewController(withIdentifier: "MainController") as! MyTabBarController
navVC.loggedAlready = true
// is the main controller for the drawer.
let drawerVC = storyBoard.instantiateViewController(withIdentifier: "DrawerVC")
// is the drawer, and the drawer needs a main controller
appDelegate.drawerController.mainViewController = navVC
appDelegate.drawerController.drawerViewController = drawerVC
appDelegate.drawerController.drawerDirection = .right
appDelegate.window?.rootViewController = appDelegate.drawerController
appDelegate.window?.makeKeyAndVisible()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment