EasySlide is a simple and powerful slide in menu framework, that enables you to easily add a hamburger style slide in menu to your swift iOS application. It is powerful, configurable and completly contained in just one, 500 line class file.
(Slide Along, Slide Over, Slide Under)
- Both left and right menus supported
- Configurable animation types (Slide Under, Slide Over, Slide Along)
- Supports reveal by panning
- Written to support autolayout
- Basic API calls make integration a breeze
// setup
func setupMenuViewController(menu: MenuType, viewController: UIViewController)
func setBodyViewController(viewController: UIViewController, closeOpenMenu:Bool, ignoreClassMatch:Bool)
// open/close methods
func openMenu(menu: MenuType, animated:Bool, completion:(Void)->(Void))
func closeOpenMenu(animated:Bool, completion:(Void)->(Void))
// checking
func isMenuOpen(menu: MenuType) -> Bool
// configurations
func setMenuRevealType(menu: MenuType, revealType:RevealType)
func setMenuWidth(menu: MenuType, width:CGFloat)
func setMenuAnimationSpeed(menu: MenuType, speed:CGFloat)
func enableMenu(menu: MenuType, enabled:Bool)
func enableMenuShadow(menu: MenuType, enabled:Bool)
func enableMenuPanning(menu: MenuType, enabled:Bool)
func limitPanningAccess(shouldLimit:Bool, leftRange: CGFloat, rightRange:CGFloat)
protocol EasySlideDelegate{
func easySlidePanAccessAvailable() -> Bool
}
protocol MenuDelegate{
var easySlideNavigationController: ESNavigationController? { get set }
}
Simply import ESNavigationController.swift into your project and set it as your Navigation Controllers class type.
THAT's IT!
Your Slide in menu is fully integrated and can now be configured to your liking.
To set the menu view controller, simply call the method
func setupMenuViewController(menu: MenuType, viewController: UIViewController)
The menu argument, specifies the menu you are setting (.LeftMenu or .RightMenu)
The viewController argument, specifies the view controller you are assigning to the menu
To change the current main root view controller, simply call
setBodyViewController(viewController: UIViewController, closeOpenMenu:Bool, ignoreClassMatch:Bool)
The viewController argument specifies the view controller you are assigning to the main view
The closeOpenMenu argument specifies if you want the menu to close after changing the view controller
The ignoreClassMatch argument specifies weather the view controller should be assigned if it is of the exact same class as the current main view controller.
To open a menu, Simply Call
openMenu(menu: MenuType, animated:Bool, completion:(Void)->(Void))
To Close A Menu, Simply Call
closeOpenMenu(animated:Bool, completion:(Void)->(Void))
To Check If A Menu Is Open, Simply Call
isMenuOpen(.LeftMenu)
Enable/Disable A Menu
enableMenu(.RightMenu, false)
Enable/Disable Shadows
enableMenuShadow(.LeftMenu, true)
Enable/Disable Panning
enableMenuPanning(.LeftMenu, false)
Change the Animation Type
setMenuRevealType(.BothMenus, revealType:.SlideOver)
Change the Menu Width
setMenuWidth(.LeftMenu, width:250)
Change the Animation Speed
setMenuAnimationSpeed(.BothMenus, speed:0.25)
Limit Panning To Touches Near The Edges Of The Screen
limitPanningAccess(true, leftRange: 60, rightRange: 60)
By default, any root view controller of the ESNavigationController can access side menus by panning, while all others have this panning access disabled. This is likely the behaviour most applications will need, however, if you wish to enable panning access from a pushed or presented view controller, the EasySlideDelegate can be used.
Enables/Disables Panning Menu Within Current Controller
easySlidePanAccessAvailable() -> Bool
n.b. This method does not interfere with the configured panning settings
In order to access the ESNavigationController object from within your menu, it is recommened that your menu classes conform to the protocol MenuDelegate. This protocol requires a single property be added, which can then be set to the ESNavigationController object at the time of initialisation.
Enables Access From Menu To ESNavigationController
var easySlideNavigationController: ESNavigationController? { get set }
Happy sliding!