# SWRevealViewController
# Setting up a basic app with SWRevealViewController
Create a basic application with single view application template with swift as language
Add SWRevealViewController.h
and SWRevealViewController.m
then click on Create Bridging Header button
and add
#import "SWRevealViewController.h"
on the Bridging header
Then select viewController on storyboard and change class to SWRevealViewController
Then rename the viewController on files to MainViewController and add new ViewController with RightViewController name
then we add two segues from SWRevealViewController to MainViewController and from SWRevealViewController to RightViewController, then we need to select the first (from SWRevealViewController to MainViewController) and edit properties
on identifier set sw_front
on Class set SWRevealViewControllerSegueSetController
after this we need to do the same with the segue (from SWRevealViewController to RightViewController)
on identifier set sw_rear
on Class set SWRevealViewControllerSegueSetController
then on MainViewController add this line on viewDidLoad
method
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer());
And this is all, you have a basic app with SWRevealViewController integrated, you can swipe to right to show RightViewController
as lateral menu
# Remarks
Using the SWRevealViewController class as the main navigation might not always result in the best user experience. If the sidebar contains only 5 or less entries (or the content can be compressed into 5 or less entries), you should consider using the default tab bar.
The tab bar is intuitive and allows the user to quickly change between views/contexts. On the other hand, the sidebar navigation can perform more actions than switching the view/context and uses less space when collapsed.
For more information check out Apple's iOS Human Interface Guidelines (opens new window).