AKSideMenu

April 28, 2026 ยท View on GitHub

Building CocoaPods License Carthage compatible

AKSideMenu is a UIKit side menu controller for iOS. It supports left and right menus, pan gestures, menu transitions, content scaling, shadows, fade effects, and optional parallax motion.

AKSideMenu screenshot AKSideMenu demo

Requirements

  • iOS 12.0+
  • Swift 5.6+
  • UIKit
  • ARC

Installation

Swift Package Manager

In Xcode, open File > Add Package Dependencies... and use:

https://github.com/dogo/AKSideMenu.git

Or add it to Package.swift:

dependencies: [
    .package(url: "https://github.com/dogo/AKSideMenu.git", from: "1.4.7")
],
targets: [
    .target(
        name: "YourTarget",
        dependencies: ["AKSideMenu"]
    )
]

CocoaPods

Add AKSideMenu to your Podfile:

pod 'AKSideMenu'

Then run:

pod install

Carthage

Add AKSideMenu to your Cartfile:

github "dogo/AKSideMenu" "1.4.7"

Then run:

carthage update --use-xcframeworks

Quick Start

Create your content controller, optional left and right menu controllers, and make AKSideMenu the root controller.

import AKSideMenu
import UIKit

@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        let window = UIWindow(frame: UIScreen.main.bounds)

        let contentViewController = UINavigationController(rootViewController: FirstViewController())
        let leftMenuViewController = LeftMenuViewController()
        let rightMenuViewController = RightMenuViewController()

        let sideMenuViewController = AKSideMenu(
            contentViewController: contentViewController,
            leftMenuViewController: leftMenuViewController,
            rightMenuViewController: rightMenuViewController
        )

        sideMenuViewController.contentViewShadowEnabled = true
        sideMenuViewController.contentViewShadowOpacity = 0.4
        sideMenuViewController.contentViewScaleValue = 0.8

        window.rootViewController = sideMenuViewController
        window.backgroundColor = .white
        window.makeKeyAndVisible()

        self.window = window
        return true
    }
}

Presenting Menus

Every child controller can access the nearest side menu controller through sideMenuViewController.

sideMenuViewController?.presentLeftMenuViewController()
sideMenuViewController?.presentRightMenuViewController()
sideMenuViewController?.hideMenuViewController()

You can also wire buttons directly in Interface Builder using these IBAction helpers:

@IBAction func presentLeftMenuViewController(_: AnyObject)
@IBAction func presentRightMenuViewController(_: AnyObject)

Switching Content

Use setContentViewController(_:animated:) when a menu item should replace the main content.

let nextViewController = UINavigationController(rootViewController: SettingsViewController())

sideMenuViewController?.setContentViewController(nextViewController, animated: true)
sideMenuViewController?.hideMenuViewController()

Storyboard Setup

AKSideMenu can instantiate its content and menu controllers directly from storyboard identifiers.

  1. Add a root view controller to your storyboard.
  2. Set its class to AKSideMenu or to your own AKSideMenu subclass.
  3. Add controllers for the content, left menu, and right menu.
  4. Set their Storyboard IDs.
  5. In the Attributes inspector for the side menu controller, set:
    • contentViewStoryboardID
    • leftMenuViewStoryboardID
    • rightMenuViewStoryboardID

You can also configure the controllers manually in a subclass:

import AKSideMenu
import UIKit

final class RootViewController: AKSideMenu {
    override func awakeFromNib() {
        super.awakeFromNib()

        contentViewController = storyboard?.instantiateViewController(withIdentifier: "contentViewController")
        leftMenuViewController = storyboard?.instantiateViewController(withIdentifier: "leftMenuViewController")
        rightMenuViewController = storyboard?.instantiateViewController(withIdentifier: "rightMenuViewController")
    }
}

Delegate

Set the delegate to observe menu presentation, hiding, and gesture-recognizer behavior.

sideMenuViewController.delegate = self
extension RootViewController: AKSideMenuDelegate {
    func sideMenu(_ sideMenu: AKSideMenu, willShowMenuViewController menuViewController: UIViewController) {
        print("Will show menu")
    }

    func sideMenu(_ sideMenu: AKSideMenu, didShowMenuViewController menuViewController: UIViewController) {
        print("Did show menu")
    }

    func sideMenu(_ sideMenu: AKSideMenu, willHideMenuViewController menuViewController: UIViewController) {
        print("Will hide menu")
    }

    func sideMenu(_ sideMenu: AKSideMenu, didHideMenuViewController menuViewController: UIViewController) {
        print("Did hide menu")
    }

    func sideMenu(_ sideMenu: AKSideMenu, didRecognizePanGesture recognizer: UIPanGestureRecognizer) {
        print("Pan gesture recognized")
    }
}

Available delegate methods:

optional func sideMenu(_ sideMenu: AKSideMenu, shouldRecognizeGesture recognizer: UIGestureRecognizer, simultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool
optional func sideMenu(_ sideMenu: AKSideMenu, gestureRecognizer: UIGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: UIGestureRecognizer) -> Bool
optional func sideMenu(_ sideMenu: AKSideMenu, gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool
optional func sideMenu(_ sideMenu: AKSideMenu, didRecognizePanGesture recognizer: UIPanGestureRecognizer)
optional func sideMenu(_ sideMenu: AKSideMenu, willShowMenuViewController menuViewController: UIViewController)
optional func sideMenu(_ sideMenu: AKSideMenu, didShowMenuViewController menuViewController: UIViewController)
optional func sideMenu(_ sideMenu: AKSideMenu, willHideMenuViewController menuViewController: UIViewController)
optional func sideMenu(_ sideMenu: AKSideMenu, didHideMenuViewController menuViewController: UIViewController)

Configuration

PropertyDefaultDescription
contentViewControllernilMain controller displayed above the menus.
leftMenuViewControllernilController used as the left menu.
rightMenuViewControllernilController used as the right menu.
backgroundImagenilOptional image displayed behind the menu and content containers.
animationDuration0.35Duration used for menu and content animations.
panGestureEnabledtrueEnables or disables pan gesture handling.
panFromEdgetrueRequires the pan gesture to begin near the screen edge.
panFromEdgeZoneWidth20.0Width of the edge zone that starts menu panning.
panMinimumOpenThreshold60.0Minimum pan distance needed to open a menu.
panGestureLeftEnabledtrueEnables pan gestures for the left menu.
panGestureRightEnabledtrueEnables pan gestures for the right menu.
interactivePopGestureRecognizerEnabledtrueKeeps navigation controller interactive pop gestures available when possible.
scaleContentViewtrueScales the content view while a menu is visible.
contentViewScaleValue0.7Scale applied to the content view.
contentViewFadeOutAlpha1.0Alpha applied to the content view while a menu is visible.
contentViewInLandscapeOffsetCenterX30.0Horizontal content offset in landscape.
contentViewInPortraitOffsetCenterX30.0Horizontal content offset in portrait.
contentViewShadowEnabledfalseEnables a shadow around the content view.
contentViewShadowColor.blackShadow color for the content view.
contentViewShadowOffset.zeroShadow offset for the content view.
contentViewShadowOpacity0.4Shadow opacity for the content view.
contentViewShadowRadius8.0Shadow blur radius for the content view.
scaleMenuViewtrueApplies menuViewControllerTransformation before the menu animates in.
menuViewControllerTransformationCGAffineTransform(scaleX: 1.5, y: 1.5)Initial menu transform.
fadeMenuViewtrueFades the menu view during presentation and dismissal.
scaleBackgroundImageViewtrueScales the background image before the menu opens.
backgroundTransformScale1.7Scale applied to the background image view.
parallaxEnabledtrueEnables motion-effect parallax.
parallaxMenuMinimumRelativeValue-15Minimum menu parallax value.
parallaxMenuMaximumRelativeValue15Maximum menu parallax value.
parallaxContentMinimumRelativeValue-25Minimum content parallax value.
parallaxContentMaximumRelativeValue25Maximum content parallax value.
bouncesHorizontallytrueAllows horizontal panning past the fully opened menu position.
menuPreferredStatusBarStyle.defaultPreferred status bar style while a menu is visible.
menuPrefersStatusBarHiddenfalseControls status bar visibility while a menu is visible.

Examples

The repository includes sample apps in AKSideMenuExamples:

  • Simple: programmatic UIKit setup.
  • Storyboard: storyboard-based setup.

Open either example project in Xcode and run the shared scheme.

Contributing

Ideas, issues, and pull requests are welcome. Please keep changes focused and include an example or test when the behavior changes.

Credits

AKSideMenu was inspired by RESideMenu by Roman Efimov.

License

AKSideMenu is available under the MIT license. See LICENSE for details.