2

I have just implemented an SWRevealViewController into my application and I have one problem.

The front view (the view on top of the table view) is not the view controller I want on top. I have two view controllers which I link to from my table view and the one I don't want displaying shows up.

How can I set One of the two view controllers I want at the front upon app launch?

GilZ
  • 6,418
  • 5
  • 30
  • 40
needshelp
  • 595
  • 1
  • 6
  • 25

1 Answers1

1
   let frontNavigationController:UINavigationController
   let rearNavigationController:UINavigationController

   let revealController = SWRevealViewController()
   var mainRevealController = SWRevealViewController()

   let sidebar = self.storyboard?.instantiateViewController(withIdentifier:  “sideVCID”)as! Sidebar
   let home = self.storyboard?.instantiateViewController(withIdentifier: "HomeVCID")as!HomeVC

   frontNavigationController =  UINavigationController(rootViewController: home);
   rearNavigationController = UINavigationController(rootViewController: sidebar)

   revealController.frontViewController = frontNavigationController;
   revealController.rearViewController = rearNavigationController;
   revealController.delegate = self;
   mainRevealController  = revealController
   self.window?.rootViewController =  = mainRevealController
Lalit kumar
  • 1,797
  • 1
  • 8
  • 14
  • This answer confuses me. I have all of my storyboard laid out with the segues but what I need is one of the controllers to always appear first. I don't know where to put this code and it certainly doesn't look like it is in the viewWillAppear method which I would have thought would be ideal – needshelp Jan 10 '17 at 12:20
  • You can use Login button click or if you want to make home page than use this code in didfinishlaunch – Lalit kumar Jan 10 '17 at 12:34
  • How do I attach it to the view on the storyboard – needshelp Jan 11 '17 at 03:58
  • No need to attach in storyboard only give storyboard id ex -> HomeVCID of your view controller and write the above code – Lalit kumar Jan 11 '17 at 04:51