Right side menu in a tab application with a login screen

77 Views Asked by At

I am creating a simple tab bar application and have implemented the side nav using MMDrawerController https://github.com/mutualmobile/MMDrawerController

I have imported the relevant files into my project and have been following this tutorial: https://www.youtube.com/watch?v=TdKnImb4SWs

It works correctly however the issue I am having is when I implement a user login screen (loginViewController) and despite setting it as my initial view controller, the intial view still defaults to the first tab. I understand this is because of a function set in my AppDelegate which is:

func buildNavigationDrawerInterface(){

    let mainStoryBoard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let mainPage : TabBarViewController = mainStoryBoard.instantiateViewController(withIdentifier: "MainTabBar") as! TabBarViewController
    let rightSideMenu : RightSideViewController = mainStoryBoard.instantiateViewController(withIdentifier: "RightSideViewController") as! RightSideViewController
    let rightSideMenuNav = UINavigationController(rootViewController: rightSideMenu)

    drawerContainer = MMDrawerController(center: mainPage, rightDrawerViewController: rightSideMenuNav)
    drawerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.panningCenterView
    drawerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.panningCenterView

    window?.rootViewController = drawerContainer
}

I know (or at least think) that the last line is the reason the application starts at the tabs and not at login. When I remove this, the app starts at login however once in, the menu no longer works.

So my question:

Is there a way I can override the last line of the function so that the loginViewController is the intial view AND the menu functionality works? Or alternatively, is there another route I can take to implement what I am trying to do? I do not have to use MMDrawerController

0

There are 0 best solutions below