title: swift slide out menu without sliding the navigationbar (programatically)
body: <p>I've been trying to make a left slide-out menu for a couple of days. I couldn't get any of the libraries to work with my application, so I resorted to raywenderlich's tutorial:</p>
  
  <p><a href="http://www.raywenderlich.com/78568/create-slide-out-navigation-panel-swift" rel="nofollow noreferrer">http://www.raywenderlich.com/78568/create-slide-out-navigation-panel-swift</a></p>
  
  <p>However, it doesn't do exactly what I want. My main problem is that when I slide out the menu the navigation bar slides out with it. I need my navigation bar to stay where it is and only move the content underneath it.</p>
  
  <p>I tried "self.view.bringSubviewToFront(navigationController.navigationBar)" But that didn't work.</p>
  
  <p>Here's a screenshot of what I'm trying to accomplish.</p>
  
  <p><img src="https://i.stack.imgur.com/qQFcf.png" alt="enter image description here"></p>
  
  <p>My current setup is made using a <code>ContainerViewController</code> that's set in my <code>appDelegate's</code>didFinishLaunchingWithOptions`:</p>
  
  <pre><code>window = UIWindow(frame: UIScreen.mainScreen().bounds)
  
      let containerViewController = ContainerViewController()
  
      window!.rootViewController = containerViewController
      window!.makeKeyAndVisible()
  
      return true
  </code></pre>
  
  <p>This ContainerViewController is getting 2 childViewControllers.</p>
  
  <p>the CenterViewControllerController (my content)</p>
  
  <p>The CenterViewController will have the navigationController correctly set up.</p>
  
  <pre><code>var centerNavigationController: NavigationController!
  var centerViewController: CenterViewController!
  </code></pre>
  
  <p>In the <code>ContainerViewController</code> <code>viewDidLoad</code>:</p>
  
  <pre><code>  override func viewDidLoad() {
      super.viewDidLoad()
  
      centerViewController = UIStoryboard.centerViewController()
      centerViewController.delegate = self
  
      // wrap the centerViewController in a navigation controller, so we can push views to it
      // and display bar button items in the navigation bar
      centerNavigationController = NavigationController(rootViewController: LandingPageVC())
      view.addSubview(centerNavigationController.view)
      addChildViewController(centerNavigationController)
  
      centerNavigationController.didMoveToParentViewController(self)
  
      let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: "handlePanGesture:")
      centerNavigationController.view.addGestureRecognizer(panGestureRecognizer)
    }
  </code></pre>
  
  <p>and the SidePanelViewController (my menu &amp; the problematic one.)</p>
  
  <pre><code>var leftViewController: SidePanelViewController?
  
    func addLeftPanelViewController() {
      if (leftViewController == nil) {
          leftViewController = SidePanelViewController()
  
          addChildSidePanelController(leftViewController!)
      }
    }
  
    func addChildSidePanelController(sidePanelController: SidePanelViewController) {
      println("addChildSidePanelController")
  
      view.insertSubview(sidePanelController.view, atIndex: 0)
  
      addChildViewController(sidePanelController)
      sidePanelController.didMoveToParentViewController(self)
    }
  </code></pre>
  
  <p>The <code>SidePanelViewController</code> currently doesn't have a navigationController. I did try adding it. But that did not have the desired results.</p>
  
  <p>Based on the comments, what I need to do is somehow making the ContainerViewController the one that has a navigationController, so both of it's childControllers should have that as well? However I have no clue how I would go about adding the navigationController on that level.</p>
  
  <p>Any help would be greatly appreciated! (I'm not using storyboards)</p>
  
  <p>Libraries I tried:</p>
  
  <p>ENSwiftSideMenu (did what I want. But spent 2 days trying to make it work with no results)</p>
  
  <p>Brian Advent youtube tutorial</p>
  
  <p>Dekatotoro's SlideMenuControllerSwift</p>
  
  <p>wanaya/Slide-Menu</p>
  
  <p>SWRevealViewController in Swift</p>