Skip to content

A simple Google Material Design-style side menu for iOS

License

Notifications You must be signed in to change notification settings

Logomorph/MaterialSideMenu

Repository files navigation

MaterialSideMenu

Version License Swift5 Carthage compatible Platform

If you found MaterialSideMenu helpful and you liked it, give it a ★ at the top right of this page.

Overview

MaterialSideMenu is a simple Google Material Design-style side menu for iOS

Preview

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Xcode 10.
  • Swift 5.
  • iOS 11 or higher.

Installation

CocoaPods

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

pod 'MaterialSideMenu'

After that, run the following command:

$ pod install

Carthage

To install MaterialSideMenu with Carthage, add the below line in your Cartfile:

github "Logomorph/MaterialSideMenu" "master"

Manual

Copy MaterialSideMenuViewController.swift into your project and build

Usage

From code

First:

import MaterialSideMenu

Declare the menu and initialize it with a home controller (the bottom view) and the controller to be used as a side menu:

let sideMenuViewController = MaterialSideMenuViewController(homeViewController: homeViewController, mainMenuViewController: mainMenuController)

The menu is a UIViewController which can be added either as the rootViewController or pushed. It has its own navigationController on which it pushes the new controllers.

Push new view controllers on its stack:

sideMenuViewController.pushViewController(newController, animated: false)

This will dismiss all view controllers alread on the stack, except the homeViewController and add the new controller on top.

When a controller gets pushed, the side gesture to open the menu gets added automatically. If you don't need that, you can add this protocol to the controller you're pushing:

MaterialSideMenuNeedsGestures

and override its variable to return false

var needsGestures:Bool { return false }

Go home:

sideMenuViewController.goHome()

Dismisses all view controllers and leaves the home view controller on the stack.

Known Issues

None, yet. Please report the issues you find some

License

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