diff --git a/DrawerController/DrawerController.swift b/DrawerController/DrawerController.swift index ad21e40..97d6969 100644 --- a/DrawerController/DrawerController.swift +++ b/DrawerController/DrawerController.swift @@ -115,6 +115,9 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { didSet { fadeView.backgroundColor = fadeColor } } + @IBInspectable + public var isEnableAutoSwitchDirection: Bool = false + @IBInspectable public var animationDuration: TimeInterval = 0.35 @@ -917,6 +920,17 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { return percentage } + guard ss.isEnableAutoSwitchDirection else { + switch from { + case .left: + guard percentage > 0.0 else { return 0.0 } + case .right: + guard percentage < 0.0 else { return 0.0 } + default: + return percentage + } + return percentage + } guard ss.contentMap[to] != nil else { return 0.0 } diff --git a/KWDrawerController.podspec b/KWDrawerController.podspec index 2c6447f..5a22515 100644 --- a/KWDrawerController.podspec +++ b/KWDrawerController.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'KWDrawerController' - s.version = '4.0' + s.version = '4.1' s.summary = 'Drawer view controller that easy to use!' s.license = { :type => 'MIT', :file => 'LICENSE' } s.homepage = 'https://github.com/kawoou/KWDrawerController' diff --git a/README.md b/README.md index 03af539..2e587ae 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ KWDrawerController is available on [CocoaPods](https://github.com/cocoapods/coco pod 'KWDrawerController', '~> 3.7' // Swift 4 -pod 'KWDrawerController', '~> 4.0' +pod 'KWDrawerController', '~> 4.1' ``` @@ -236,6 +236,7 @@ Changelog + 3.6.1 Fixed layout issue when rotate device. + 3.7 Fixed not updating issues on properties. + 4.0 Support Swift 4. ++ 4.1 Implement new flag that enables direction auto-switching. ⚠️ Requirements --------------