Search code examples
iosswiftios9swrevealviewcontroller

Using SWReveal in multiple views


I am using SWReveal in my main view, it works perfectly, but when I try to connect SWReveal to another view controller it won't work.

I mean I want to show SWReveal menu in any view contoller that I want, what is the solution?


Solution

  • You need to change front view of swreveal by pushing

    self.revealViewController().pushFrontViewController(newFrontViewController, animated: true)
    

    After that add target to menu button

    button.addTarget( self.revealViewController(), action:"revealToggle:" , forControlEvents: UIControlEvents.TouchUpInside)