Lightweight pod for inegration simple sideMenu to your iOS app.
Using CocoaPods:
Simply add the following line to your Podfile:
pod 'HKSideMenu'
This will download the SideMenu binaries and dependencies in Pods/
during your next
pod install
execution.
This is the recommended way to install a specific version of SideMenu.
- Create
Menu
forSideMenu
.
To do so, create UIViewController
that conforms MenuPresentable
. Override storyboardName
- name for storyboard file in which Menu controller xib placed and controllerIdentifier
- storyboard Id of controller.
Below example for MenuController that placed inside Main.storyboard
and have identifier MenuController
import UIKit
final class MenuController: UIViewController, MenuPresentable {
static var storyboardName: String {
return "Main"
}
static var controllerIdentifier: String {
return String(describing: MenuController.self)
}
}
Note: default implementation include next for controllerIdentifier
:
static var controllerIdentifier: String {
return String(describing: self)
}
- Create
RootController
forSideMenu
.
This is controller, that will hold all content and side menu item.
For creating rootController you should create/use class RootSideMenuController
. This class should be informed where he should look for Menu
. To inform class about it - set sideMenu type to RootSideMenuAppearence.menuType
before RootSideMenuController
loaded:
RootSideMenuAppearence.menuType = MenuController.self
Full code:
import UIKit
final class MyRootController: RootSideMenuController {
// MARK: - LifeCycle
override func viewDidLoad() {
// make sure this done before `super.viewDidLoad`, in other case you will receive assertion
RootSideMenuAppearence.menuType = MenuController.self
super.viewDidLoad()
}
}
✅ That's it - you done! Build and run the project.
To control menu state use hideMenu
and showMenu
actions from RootSideMenuController
.
User different options from RootSideMenuAppearence
for controlling appearence of menu
/// Side offset for menu - display visible gap when full menu isOpened
///
/// Default - 60.0
public static var openMenuOffset: CGFloat = 60
/// Color which used for dimming content while side menu opened
///
/// Default - UIColor.lightGray.withAlphaComponent(0.5)
public static var dimmingViewColor: UIColor = UIColor.lightGray.withAlphaComponent(0.5)
/// Indicate whenever we should used shadow on side menu while it's opened
///
/// Default - true, enabled
public static var showShadow: Bool = true
/// Shadow color for side menu, used with `showShadow` option
///
/// Default - UIColor.lightGray
public static var shadowColor: UIColor = UIColor.lightGray
/// Indicate whenever we should show side menu from left or right side
///
/// Default - Show from right
public static var showMenuOnRightSide: Bool = false
/// Indicate whenever we should allow to perform damping pan for side menu when it comes to final position
/// If enabled - make sure your side menu has some extended not clipped view
///
/// Default - false, disabled
public static var enablePanDamping: Bool = false
/// Hold registered type for side menu
public static var menuType: MenuPresentable.Type!
- test
- option to move content instead of menu overlapping
- more appearence options
- simo menu (from left and right sides)
- Xcode 10 or higher
- iOS 11 or higher
- Swift 5 or higher
- Cocoapods
Have a question or an issue about CalendarView
? Create an issue!
If you would like to contribute - just create a pull request.