https://github.com/ykyouhei/KYDrawerController
Side Drawer Navigation Controller similar to Android
https://github.com/ykyouhei/KYDrawerController
carthage cocoapods drawer drawerviewcontroller pod storyboard swift
Last synced: about 1 month ago
JSON representation
Side Drawer Navigation Controller similar to Android
- Host: GitHub
- URL: https://github.com/ykyouhei/KYDrawerController
- Owner: ykyouhei
- License: mit
- Created: 2015-05-15T13:51:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-09-01T10:35:17.000Z (over 4 years ago)
- Last Synced: 2025-03-17T19:02:15.847Z (about 2 months ago)
- Topics: carthage, cocoapods, drawer, drawerviewcontroller, pod, storyboard, swift
- Language: Swift
- Homepage:
- Size: 112 KB
- Stars: 621
- Watchers: 25
- Forks: 158
- Open Issues: 49
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - KYDrawerController - Side Drawer Navigation Controller similar to Android. (OOM-Leaks-Crash / Side Drawer)
README
# KYDrawerController
[](https://github.com/Carthage/Carthage)
[](http://cocoadocs.org/docsets/KYDrawerController/)
[](http://cocoadocs.org/docsets/KYDrawerController/)
[](https://github.com/ykyohei/KYDrawerController/blob/master/LICENSE)
[](https://developer.apple.com/swift)
`KYDrawerController` is a side drawer navigation container view controller similar to Android.
* Storyboard Support
* AutoLayout Support 
## Installation
### CocoaPods
`KYDrawerController ` is available on CocoaPods.
Add the following to your `Podfile`:```ruby
pod 'KYDrawerController'
```### Manually
Just add the Classes folder to your project.## Usage
(see sample Xcode project in `/Example`)### Code
```Swift
import UIKit
import KYDrawerController@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let mainViewController = MainViewController()
let drawerViewController = DrawerViewController()
let drawerController = KYDrawerController()
drawerController.mainViewController = UINavigationController(
rootViewController: mainViewController
)
drawerController.drawerViewController = drawerViewController
/* Customize
drawerController.drawerDirection = .Right
drawerController.drawerWidth = 200
*/
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = drawerController
window?.makeKeyAndVisible()
return true
}
```### Storyboard
1. Set the `KYDrawerController` to Custom Class of Initial ViewController.

2. Connects the `KYEmbedDrawerControllerSegue` to DrawerViewController from `KYDrawerController`
3. Connects the `KYEmbedMainControllerSegue` to DrawerViewController from `KYDrawerController`

4. Set the SegueIdentifiers to inspector of `KYDrawerController`.

### Open/Close Drawer
```Swift
func setDrawerState(state: DrawerState, animated: Bool)
```### Delegate
```Swift
optional func drawerController(_ drawerController: KYDrawerController, willChangeState state: KYDrawerController.DrawerState)
optional func drawerController(_ drawerController: KYDrawerController, didChangeState state: KYDrawerController.DrawerState)
```## Objective-C version
https://github.com/AustinChou/KYDrawerController-ObjC
## License
This code is distributed under the terms and conditions of the [MIT license](LICENSE).