Skip to content

kaorimatz/KZSideDrawerController

Repository files navigation

KZSideDrawerController

CI Status Version License Platform

KZSideDrawerController is a side drawer controller for iOS written in Swift.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Creating a Side Drawer Controller

let sideDrawerController = KZSideDrawerController()
sideDrawerController.centerViewController = UIViewController()
sideDrawerController.leftViewController = UIViewController()
sideDrawerController.rightViewController = UIViewController()

Opening and Closing a Drawer

sideDrawerController.openDrawer(side: .Left, animated: true, completion: nil)
sideDrawerController.closeDrawer(side: .Right, animated: true, completion: nil)

Responding to Side Drawer Controller Events

extension ViewController: KZSideDrawerControllerDelegate {
    func sideDrawerController(sideDrawerController: KZSideDrawerController, willOpenViewController viewController: UIViewController, forSide side: KZDrawerSide, animated: Bool) {}
    func sideDrawerController(sideDrawerController: KZSideDrawerController, didOpenViewController viewController: UIViewController, forSide side: KZDrawerSide, animated: Bool) {}
    func sideDrawerController(sideDrawerController: KZSideDrawerController, willCloseViewController viewController: UIViewController, forSide side: KZDrawerSide, animated: Bool) {}
    func sideDrawerController(sideDrawerController: KZSideDrawerController, didCloseViewController viewController: UIViewController, forSide side: KZDrawerSide, animated: Bool) {}
}

Customization

  • leftDrawerWidth
    • The width of the left drawer. Defaults to 280.0.
  • rightDrawerWidth
    • The width of the right drawer. Defaults to 280.0.
  • shadowOpacity
    • The opacity of the drawer's shadow. Defaults to 0.5.
  • shadowRadius
    • The blur radius of the drawer's shadow. Defaults to 3.0.
  • shadowOffset
    • The offset of the drawer's shadow. Defaults to (0.0, 0.0).
  • shadowColor
    • The color of the drawer's shadow. Defaults to opaque black color.
  • dimmingColor
    • The color used to dim the center view while the drawer is open. Defaults to black color with alpha 0.3.

Requirements

  • iOS 7.0+
  • Xcode 7+

Installation

KZSideDrawerController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "KZSideDrawerController"

Author

Satoshi Matsumoto, kaorimatz@gmail.com

License

KZSideDrawerController is available under the MIT license. See the LICENSE file for more info.

About

A side drawer controller for iOS written in Swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published