I\'d like to implement navigation drawer like Uber into iOS(swift). I\'m going to achieve it by using a library, called KYDrawerController. https://github.com/ykyouhei/KYDrawerC
Using KYDrawerController it can be implemented as follows:
class MainViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.backgroundColor = UIColor.whiteColor()
title = "MainViewController"
navigationItem.leftBarButtonItem = UIBarButtonItem(
title: "Open",
style: UIBarButtonItemStyle.Plain,
target: self,
action: "didTapOpenButton:"
)
}
func didTapOpenButton(sender: UIBarButtonItem) {
if let drawerController = navigationController?.parentViewController as? KYDrawerController {
drawerController.setDrawerState(.Opened, animated: true)
}
}
}
https://github.com/ykyouhei/KYDrawerController/tree/master/Example/Code