MaterialSideMenu is a simple Google Material Design-style side menu for iOS
To run the example project, clone the repo, and run pod install
from the Example directory first.
- Xcode 10.
- Swift 5.
- iOS 11 or higher.
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
To install MaterialSideMenu
with Carthage, add the below line in your Cartfile
:
github "Logomorph/MaterialSideMenu" "master"
Copy MaterialSideMenuViewController.swift
into your project and build
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.
None, yet. Please report the issues you find some
MaterialSideMenu is available under the MIT license. See the LICENSE file for more info.