explaingit

john-lluch/swrevealviewcontroller

4,491Objective-CAudience · developerComplexity · 2/5Setup · easy

TLDR

SWRevealViewController is an iOS library that adds a slide-out side-menu panel to iPhone and iPad apps, like the drawer menu in the old Facebook app, by copying just two files into your Xcode project.

Mindmap

mindmap
  root((SWRevealViewController))
    What it does
      Slide-out side panels
      iOS drawer navigation
    Panels
      Left panel
      Right panel
    Integration
      Copy 2 source files
      Storyboard support
    Behavior
      Swipe to open
      Tap to close
      Delegate callbacks
    Audience
      iOS developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a slide-out navigation drawer to an iOS app without writing gesture and animation code from scratch.

USE CASE 2

Build a left and right side panel layout for an iPad app that reveals when the user swipes.

USE CASE 3

Set up swipe-to-open and tap-to-close gesture behavior on any view in an iPhone app.

USE CASE 4

Embed a hidden menu behind the main content screen, following the classic drawer navigation pattern.

Tech stack

Objective-CiOS

Getting it running

Difficulty · easy Time to first run · 30min

CocoaPods listing not actively maintained, install by copying two source files directly into your Xcode project.

In plain English

SWRevealViewController is an iOS library written in Objective-C that adds a sliding side-panel navigation pattern to iPhone and iPad apps. The pattern works like the side menu in the old Facebook app: the main screen slides sideways to reveal a hidden panel underneath, typically used as a navigation menu. The library supports panels on both the left and right sides. You install it by copying two files into your Xcode project. You create a SWRevealViewController by passing it your "rear" view controller (the hidden panel) and your "front" view controller (the main content). The library handles the sliding animation, gesture recognition (swipe to open, tap to close), and proper management of iOS lifecycle methods so that each screen in the stack behaves correctly when it appears and disappears. The pan gesture recognizer built into the library lets users drag the main content panel sideways to reveal the rear panel underneath. You can attach this gesture to any view in your app, such as a navigation bar, so the user can swipe from that area to open the menu. The position of the front panel can be set to several named values, from fully open to fully closed, with animation. The library is designed to work as a standard iOS view controller container, similar to how UINavigationController works. It can be set as the root of your app's window or embedded inside another container. It also provides delegate methods so you can respond to reveal and conceal events in your own code, and supports custom transition animations via the standard iOS animation protocol. The repository includes several example Xcode projects and supports Storyboard-based app layouts. It requires iOS 7 or later and uses ARC, which is the standard iOS memory management system. The README notes that the CocoaPods package listing is not actively kept up to date, so the easiest installation path is to copy the two source files directly.

Copy-paste prompts

Prompt 1
Using SWRevealViewController in an Objective-C iOS app, set up a root view controller that shows a left sidebar navigation menu when the user swipes right from the main screen.
Prompt 2
I want to add both a left and a right panel to my iPhone app using SWRevealViewController. Show me the setup code and how to toggle each panel from a button in the navigation bar.
Prompt 3
How do I use SWRevealViewController delegate methods to detect when the side panel finishes opening or closing, so I can update my app's state?
Open on GitHub → Explain another repo

← john-lluch on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.