KASideMenu is a simple and easy to use side menu control written in Swift.
Check out the example project to see it in action!
See the contained example to know how KASideMenu
can easily be integrated in your project.
Build the example from the Example
directory.
- XCode 10.
- iOS 9.0+
KASideMenu is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'KASideMenu'
- Create a subclass of
KASideMenu
. In this example we call itMySideMenu
. - In the Storyboard, add a
UIViewController
and set the root view's owner asMySideMenu
. - Add more view controllers to your Storyboard, and give them
Storyboard ID
with "LeftMenuViewController", "RightMenuViewController" and "CenterViewController". - Add a method
awakeFromNib
toMySideMenu.swift
with the following code:
override func awakeFromNib() {
leftMenuViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LeftMenuViewController")
rightMenuViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "RightMenuViewController")
centerViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "CenterViewController")
super.awakeFromNib()
}
Present the menu view controller:
sideMenu?.showLeft()
or
sideMenu?.showRight()
Close the menu controller:
sideMenu?.closeMenu()
ZhihuaZhang, shika.cho@kapps.co.jp
KASideMenu is available under the MIT license. See the LICENSE file for more info.