- July 26, 2025
- Mins Read
Drawer view controller that is easy to use!
KWDrawerController is available on CocoaPods. Add the following to your Podfile:
# Swift 3
pod ‘KWDrawerController’, ‘~> 3.7’
# Swift 4~
pod ‘KWDrawerController’, ‘~> 4.2’
pod ‘KWDrawerController/RxSwift’ # with RxSwift extension
Simply drag and drop the DrawerController
folder into your existing project.
import UIKit
import KWDrawerController
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let mainViewController = MainViewController()
let leftViewController = LeftViewController()
let rightViewController = RightViewController()
let drawerController = DrawerController()
drawerController.setViewController(mainViewController, .none)
drawerController.setViewController(leftViewController, .left)
drawerController.setViewController(rightViewController, .right)
/// Customizing
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = drawerController
window?.makeKeyAndVisible()
return true
}
}
Set DrawerController
as the Custom Class of the Initial ViewController.
Connect the DrawerEmbedLeftControllerSegue
and/or the DrawerEmbedRightControllerSegue
from DrawerController
to your left/right controllers.
Connect the DrawerEmbedMainControllerSegue
from DrawerController
to your main controller.
Set the segue identifiers of both the inspector of DrawerController
and the segues themselves.
/// Open
self.drawerController?.openSide(.left)
self.drawerController?.openSide(.right)
/// Close
self.drawerController?.closeSide()
optional func drawerDidAnimation(
drawerController: DrawerController,
side: DrawerSide,
percentage: Float
)
optional func drawerDidBeganAnimation(
drawerController: DrawerController,
side: DrawerSide
)
optional func drawerWillFinishAnimation(
drawerController: DrawerController,
side: DrawerSide
)
optional func drawerWillCancelAnimation(
drawerController: DrawerController,
side: DrawerSide
)
optional func drawerDidFinishAnimation(
drawerController: DrawerController,
side: DrawerSide
)
optional func drawerDidCancelAnimation(
drawerController: DrawerController,
side: DrawerSide
)
DrawerTransition
is a module that determines the rendering direction to move the Drawer. It is implemented by inheriting DrawerTransition
.
Transition
, Overflow Transition
should also use DrawerFloatTransition
.Overflow Transition
be used when Transition
beyond the open range of the drawer.
DrawerSlideTransition
, DrwaerParallaxTransition
, DrawerFoldTransition
, and DrawerSwingTransition
.Overflow Transition
, Transition
should also use DrawerFloatTransition
.Animator is a module that controls the speed of moving a drawer. It is implemented by inheriting DrawerAnimator
or DrawerTickAnimator
.
public var isTapToClose: Bool
public var isGesture: Bool
public var isAnimation: Bool
public var isOverflowAnimation: Bool
public var isShadow: Bool
public var isFadeScreen: Bool
public var isBlur: Bool
public var isEnable: Bool
getViewController
method.NavigationKit is a lightweight library which makes SwiftUI navigation super easy to use. 💻 Installation 📦 Swift Package Manager Using Swift Package Manager, add ...
An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations and programmatic navigation. NavigationStack Installation ...
With SwiftUI Router you can power your SwiftUI app with path-based routing. By utilizing a path-based system, navigation in your app becomes ...
This package takes SwiftUI's familiar and powerful NavigationStack API and gives it superpowers, allowing you to use the same API not just ...