Basic, and essential slide menu library developed with Swift 3.0.
To run the example project, clone the repo, and run pod install
from the Example directory first.
- Add
import PlainMenuController
in your ViewController which you want to call - In a particular event handler in your ViewController, add codes below
let storyboard = UIStoryboard.init(name: YOUR_MENU_VIEW_CONTROLLER, bundle: nil)
let yourMenuViewController = storyboard.instantiateInitialViewController() as! YourMenuViewControllerClass
let navigationController = UINavigationController(rootViewController: yourMenuViewController)
navigationController.modalPresentationStyle = .custom
navigationController.transitioningDelegate = self
self.present(navigationController, animated: true, completion: nil)
- In bottom of your ViewController, add codes below
extension ViewController: UIViewControllerTransitioningDelegate {
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
return MenuPresentationController(presentedViewController: presented, presenting: presenting)
}
func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return MenuPresentationAnimator(isPresentation: true)
}
func animationController(forDismissed dismissed: UIViewController)
-> UIViewControllerAnimatedTransitioning? {
return MenuPresentationAnimator(isPresentation: false)
}
}
PlainMenuController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "PlainMenuController"
keisei_1092, keisei_1092@yahoo.co.jp
PlainMenuController is available under the MIT license. See the LICENSE file for more info.