Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Overview

RevealMenuController

RevealMenuController Version License Platform

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As an additional feature you can set small image icon beside menu item text. Take a look at example screenshot to see all available features.

Features:

  • Expandable menu groups
  • Custom presentation position (top, center or bottom)
  • Custom text alignment
  • Menu items can have images

Here are few screenshot with possible usage. I've added a small video (~5Mb) also where you can see live example without installation and launching demo project.

RevealMenuController

Installation

CocoaPods

RevealMenuController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "RevealMenuController"

Cartage

Support will be added in version 1.0

Usage

Initialize RevealMenuController and set required properties:

let revealController = RevealMenuController(title: "Contact Support", position: .Center)
revealController.displayCancel = true           // Display Cancel menu item
revealController.hideOnBackgorundTap = true     // Hide menu when user taps outside of items area
revealController.statusBarStyle = .LightContent // Status bar style

Now you can add actions to menu. Take a look at image property: this menu item will have small icon places beside a text.

let webImage = UIImage(named: "IconHome")
let webAction = RevealMenuAction(title: "Open web page", image: webImage, handler: { (controller, action) in
    // Code to support tap on this item
})
revealController.addAction(webAction)

Adding of action groups is very similar:

let emailImage = UIImage(named: "IconEmail")
let phoneImage = UIImage(named: "IconCall")
let techGroup = RevealMenuActionGroup(title: "Contact support", actions: [
    RevealMenuAction(title: "[email protected]", image: emailImage, handler: { (controller, action) in
        // Code to support tap on this item
    }),
    RevealMenuAction(title: "1-866-752-7753", image: phoneImage, handler: { (controller, action) in
        // Code to support tap on this item
    })
])
revealController.addAction(techGroup)

When you're ready to present controller call:

revealController.displayOnController(self)

Appearance animation depends on it's position:

  • Top: Controller appearance will have top-to-bottom slide animation.
  • Center: Appearance with fade-in animation
  • Bottom: Appearance with bottom-to-top slide animation.

Disappearance will have reverse animation.

Dismissing

To dismiss RevealMenuController call next method. Collapse animation will be reversed to appearance one.

controller.dismissViewControllerAnimated(true, completion: {
    // Completion block
})

RevealMenuAction

RevealMenuAction can be initialized in few ways. Title is always required for action. Image is an optional value. Default text alignment is Center. Handler is also not required but if you will not specify this property there will be no response for user tap on this item.

List of initializers:

init(title: String, image: UIImage?, alignment: NSTextAlignment, handler: RevealControllerHandler?)
init(title: String, image: UIImage?, handler: RevealControllerHandler?)
init(title: String, alignment: NSTextAlignment, handler: RevealControllerHandler?)
init(title: String, handler: RevealControllerHandler?)

RevealMenuActionGroup

Action groups will keep few RevealMenuActions inside. When user press on such menu item group will expand and show list of available actions. Second tap will collapse actions list.

Title is also required for action group. It can have it's own icon image and text alignment, similar to RevealMenuAction. The only difference is that group has no tap handler but actions array instead of it.

List of initializers:

init(title: String, image: UIImage?, alignment: NSTextAlignment, actions: [RevealMenuAction])
init(title: String, alignment: NSTextAlignment, actions: [RevealMenuAction])
init(title: String, image: UIImage, actions: [RevealMenuAction])
init(title: String, actions: [RevealMenuAction])

TODO

  • Custom sizes for iPad
  • Menu item labels customization (font, color)
  • Implement menu title
  • Support for multiline items

Write me or make a pull request if you have any ideas what else functionality could be useful for RevealMenuController.

Author

License

RevealMenuController is available under the MIT license. See the LICENSE file for more info.

You might also like...
A fully customizable popup style menu for iOS 😎
A fully customizable popup style menu for iOS 😎

Guide Check out the documentation and guides for details on how to use. (Available languages:) English 简体中文 What's a better way to know what PopMenu o

iOS 7/8 style side menu with parallax effect.
iOS 7/8 style side menu with parallax effect.

RESideMenu iOS 7/8 style side menu with parallax effect inspired by Dribbble shots (first and second). Since version 4.0 you can add menu view control

A simple circle style menu.
A simple circle style menu.

Support CocoaPods. New at 2019.02.25 Use @property (nonatomic, assign) BOOL isOpened; can open or close RoundMenu. use -(void)setButtonEnable:(BOOL)en

JNDropDownMenu - Easy to use TableView style dropdown menu.
JNDropDownMenu - Easy to use TableView style dropdown menu.

Overview Swift version of https://github.com/dopcn/DOPDropDownMenu Easy to use TableView style dropdown menu. Setup The only thing you

A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)

Unfortunately, life gets in the way sometimes and I won't be able to maintain this library any longer and upgrade this library to where it needs to be

A paging view controller with a highly customizable menu ✨
A paging view controller with a highly customizable menu ✨

Getting Started | Customization | Installation Features Parchment lets you page between view controllers while showing any type of generic indicator t

Slide-Menu - A Simple Slide Menu With Swift
Slide-Menu - A Simple Slide Menu With Swift

Slide Menu!! Весь интерфейс создан через код

An iOS drop down menu with pretty animation and easy to customize.
An iOS drop down menu with pretty animation and easy to customize.

IGLDropDownMenu An iOS drop down menu with pretty animation. Screenshot How To Use Use CocoaPods: pod 'IGLDropDownMenu' Manual Install: Just drap the

Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.
Our Guillotine Menu Transitioning Animation implemented in Swift reminds a bit of a notorious killing machine.

GuillotineMenu.swift Inspired by this project on Dribbble Also, read how it was done in our blog Requirements iOS 8.0+ Xcode 10 Swift 5.0 (v 4.1+) Swi

Owner
Anatoliy Voropay
Swifter :]
Anatoliy Voropay
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
Quick Symlink - a Finder extension which provides a contextual menu item for the symbolic links creation on macOS

Quick Symlink The Quick Symlink is a Finder extension which provides a contextual menu item for the symbolic links (and other links) creation on macOS

Alexander Kropotin 29 Dec 20, 2022
iOS library - UIScrollView driven expandable menu.

UIScrollView driven expandable menu. Description AirBar is a library for creating cool expandable menus. Library observes UIScrollView scroll and prov

Uptech 625 Nov 8, 2022
EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu SwiftUI Menu but not only button (similar to the native Menu) You can c

null 10 Oct 7, 2022
slider view for choosing categories. add any UIView type as category item view. Fully customisable

CategorySliderView Horizontal or vertical slider view for choosing categories. Add any UIView type as category item view. Fully customisable Demo Inst

Cem Olcay 353 Nov 6, 2022
Swift-sidebar-menu-example - Create amazing sidebar menu with animation using swift

 SWIFT SIDEBAR MENU EXAMPLE In this project I create a awesome side bar menu fo

Paolo Prodossimo Lopes 4 Jul 25, 2022
A side menu controller written in Swift for iOS

Description SideMenuController is a custom container view controller written in Swift which will display the main content within a center panel and th

Teo 1.2k Dec 29, 2022
iOS Slide Menu Controller. It is written in pure swift.

SlideMenuController Requirements iOS 9+ Installation SlideMenuController is available through CocoaPods. To install it, simply add the following line

Myung gi son 40 Jan 16, 2022
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

Boisney Philippe 90 Oct 17, 2020
Context menu similar to the one in the Pinterest iOS app

VLDContextSheet A clone of the Pinterest iOS app context menu. Example Usage VLDContextSheetItem *item1 = [[VLDContextSheetItem alloc] initWithTitle:

Vladimir Angelov 173 Mar 28, 2022