Swift Sliding Menu

Swift Sliding Menu

1.) First, Download the SWRevealViewController library from github

2.) Inside the folder, move the SWRevealViewController.h and SWRevealViewController.m to your project. Create a header file and insert the following line

#import "SWRevealViewController.h"

3.) You'll be needing the following ViewControllers

4.) In the storyboard, select the view which has a label SWRevealViewController and change its class to SWRevealViewController. Next, control-drag from SWRevealViewController to sw_rear.

Select the "reveal view controller set segue". Select the segue and change its identifier to "sw_rear" under the identity inspector.

Next, repeat the same procedures to connect SWRevealViewController with the navigation controller of the news view controller. Again, select “reveal view controller set segue” when prompted.Set the identifier of the segue to “sw_front”.

5.) Inside the viewdidload of the swift file of sw_front, insert the following lines of code:

if self.revealViewController() != nil {
    menuButton.target = self.revealViewController()
    menuButton.action = "revealToggle:"

6.) To be able to switch to different cell, drag to the navigation controller of the view controllers and select the “reveal view controller push controller” segue under Selection Segue.

Swift Sliding Menu Swift Sliding Menu Reviewed by Edmond Legaspi on Thursday, December 10, 2015 Rating: 5

No comments:

Powered by Blogger.