The layout of the storyboard looks good. I used SWRevealController as shown below:
After logging in (executing the logon service or some process of logging in), write the code below. This code will change the current rootViewController (in your case, it is LoginViewController ) to SWRevealController . So it will work. And when you log out, change rootViewController to LoginViewController .
SWRevealViewController *controller = (SWRevealViewController *)[self.mainStoryboard instantiateViewControllerWithIdentifier:@"RevealViewController"]; [self.window setRootViewController:controller];
Remember to assign StoryboardID = "RevealViewController" in the Storyboard to SWRevealViewController .
Swift Code:
Add the function below to your AppDelegate.swift file:
func changeRootViewControllerToSWRevealViewController () { let storyboard = UIStoryboard(name: "Main", bundle: nil) let controller = storyboard.instantiateViewControllerWithIdentifier("RevealViewController") if let window = self.window{ window.rootViewController = controller } }
// Call the function above in your login action method, as shown below:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate appDelegate.changeRootViewControllerToSWRevealViewController()
source share