A simple dropdown menu component for iOS written in Swift

View the Project on GitHub Azuritul/AZDropdownMenu


CI Status Version License Platform Language

AZDropdownMenu is a simple dropdown menu component that supports Swift.


Code used in the screencast are included in the bundled sample project.


Demo Project

To run the demo project, clone the repo with git clone, and run pod install from the Example directory first.



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

pod 'AZDropdownMenu'


Declare an array of texts that are served as the item in the menu.

let titles = ["Action 1", "Action 2", "Action 3"]

Then pass the array to the initializer

let menu = AZDropdownMenu(titles: titles)

Set up so that the UIBarButtonItem is associated with a function that shows the menu

let button = UIBarButtonItem(image: UIImage(named: "menu_image"), style: .Plain, target: self, action: "showDropdown")
navigationItem.leftBarButtonItem = menuButton

Calling public func showMenuFromView(view:UIView) can then show the menu.

func showDropdown() {
    if ( == true) {
    } else {

The handler public var cellTapHandler : ((indexPath:NSIndexPath) -> Void)? would be called when menu item is tapped. So place code in here to do whatever you want. For example

menu.cellTapHandler = { [weak self] (indexPath: NSIndexPath) -> Void in
    self?.navigationController?.pushViewController(controller, animated:true)

Create menu with icons

Pass in a AZDropdownMenuItemData in the initializer: public init(dataSource:[AZDropdownMenuItemData]) and you are good to go.

Take a look at the sample project in this repository to get more usage of the library.

Configurable options

Currently AZDropdownMenu can be customized with the following properties. More will come in the future.




Chris Wu (Azuritul),


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