diff --git a/DrawerController.xcodeproj/project.pbxproj b/DrawerController.xcodeproj/project.pbxproj index 2793a78..8c9468a 100644 --- a/DrawerController.xcodeproj/project.pbxproj +++ b/DrawerController.xcodeproj/project.pbxproj @@ -128,6 +128,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = FAEF012C1AFEE4FF00DFDF7F; @@ -278,7 +279,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -298,7 +299,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.evolved.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/DrawerController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/DrawerController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/DrawerController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/DrawerController/AnimatedMenuButton.swift b/DrawerController/AnimatedMenuButton.swift index 2f40487..8687ebc 100644 --- a/DrawerController/AnimatedMenuButton.swift +++ b/DrawerController/AnimatedMenuButton.swift @@ -73,7 +73,7 @@ open class AnimatedMenuButton : UIButton { layer.strokeColor = self.strokeColor.cgColor layer.lineWidth = 1 layer.miterLimit = 2 - layer.lineCap = kCALineCapSquare + layer.lineCap = CAShapeLayerLineCap.square layer.masksToBounds = true if let path = layer.path, let strokingPath = CGPath(__byStroking: path, transform: nil, lineWidth: 1, lineCap: .square, lineJoin: .miter, miterLimit: 4) { @@ -154,7 +154,7 @@ open class AnimatedMenuButton : UIButton { let topTransform = CABasicAnimation(keyPath: "transform") topTransform.timingFunction = CAMediaTimingFunction(controlPoints: 0.5, -0.8, 0.5, 1.85) topTransform.duration = animationDuration - topTransform.fillMode = kCAFillModeBackwards + topTransform.fillMode = CAMediaTimingFillMode.backwards let bottomTransform = topTransform.copy() as! CABasicAnimation diff --git a/DrawerController/DrawerBarButtonItem.swift b/DrawerController/DrawerBarButtonItem.swift index 224d03f..183292a 100755 --- a/DrawerController/DrawerBarButtonItem.swift +++ b/DrawerController/DrawerBarButtonItem.swift @@ -44,7 +44,7 @@ open class DrawerBarButtonItem: UIBarButtonItem { public convenience init(target: AnyObject?, action: Selector, menuIconColor: UIColor, animatable: Bool) { let menuButton = AnimatedMenuButton(frame: CGRect(x: 0, y: 0, width: 26, height: 26), strokeColor: menuIconColor, animatable:animatable) menuButton.animatable = animatable - menuButton.addTarget(target, action: action, for: UIControlEvents.touchUpInside) + menuButton.addTarget(target, action: action, for: .touchUpInside) self.init(customView: menuButton) self.menuButton = menuButton diff --git a/DrawerController/DrawerController.swift b/DrawerController/DrawerController.swift index 685455a..e444dab 100644 --- a/DrawerController/DrawerController.swift +++ b/DrawerController/DrawerController.swift @@ -76,7 +76,7 @@ private func bounceKeyFrameAnimation(forDistance distance: CGFloat, on view: UIV let animation = CAKeyframeAnimation(keyPath: "position.x") animation.repeatCount = 1 animation.duration = 0.8 - animation.fillMode = kCAFillModeForwards + animation.fillMode = CAMediaTimingFillMode.forwards animation.values = values animation.isRemovedOnCompletion = true animation.autoreverses = false @@ -543,11 +543,11 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { // MARK: - UIViewController Containment - override open var childViewControllerForStatusBarHidden : UIViewController? { + override open var childForStatusBarHidden : UIViewController? { return self.childViewController(for: self.openSide) } - override open var childViewControllerForStatusBarStyle : UIViewController? { + override open var childForStatusBarStyle : UIViewController? { return self.childViewController(for: self.openSide) } @@ -704,7 +704,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { } if let sideDrawerViewControllerToHide = self.sideDrawerViewController(for: drawerToHide) { - self.childControllerContainerView.sendSubview(toBack: sideDrawerViewControllerToHide.view) + self.childControllerContainerView.sendSubviewToBack(sideDrawerViewControllerToHide.view) sideDrawerViewControllerToHide.view.isHidden = true } @@ -844,11 +844,11 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { currentSideViewController!.beginAppearanceTransition(false, animated: false) currentSideViewController!.view.removeFromSuperview() currentSideViewController!.endAppearanceTransition() - currentSideViewController!.willMove(toParentViewController: nil) - currentSideViewController!.removeFromParentViewController() + currentSideViewController!.willMove(toParent: nil) + currentSideViewController!.removeFromParent() } - var autoResizingMask = UIViewAutoresizing() + var autoResizingMask = UIView.AutoresizingMask() if drawerSide == .left { self._leftDrawerViewController = viewController @@ -859,7 +859,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { } if viewController != nil { - self.addChildViewController(viewController!) + self.addChild(viewController!) if (self.openSide == drawerSide) && (self.childControllerContainerView.subviews as NSArray).contains(self.centerContainerView) { self.childControllerContainerView.insertSubview(viewController!.view, belowSubview: self.centerContainerView) @@ -867,11 +867,11 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { viewController!.endAppearanceTransition() } else { self.childControllerContainerView.addSubview(viewController!.view) - self.childControllerContainerView.sendSubview(toBack: viewController!.view) + self.childControllerContainerView.sendSubviewToBack(viewController!.view) viewController!.view.isHidden = true } - viewController!.didMove(toParentViewController: self) + viewController!.didMove(toParent: self) viewController!.view.autoresizingMask = autoResizingMask viewController!.view.frame = viewController!.evo_visibleDrawerFrame } @@ -885,13 +885,13 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { } if let oldCenterViewController = self._centerViewController { - oldCenterViewController.willMove(toParentViewController: nil) + oldCenterViewController.willMove(toParent: nil) if animated == false { oldCenterViewController.beginAppearanceTransition(false, animated: false) } - oldCenterViewController.removeFromParentViewController() + oldCenterViewController.removeFromParent() oldCenterViewController.view.removeFromSuperview() if animated == false { @@ -902,10 +902,10 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { self._centerViewController = centerViewController if self._centerViewController != nil { - self.addChildViewController(self._centerViewController!) + self.addChild(self._centerViewController!) self._centerViewController!.view.frame = self.childControllerContainerView.bounds self.centerContainerView.addSubview(self._centerViewController!.view) - self.childControllerContainerView.bringSubview(toFront: self.centerContainerView) + self.childControllerContainerView.bringSubviewToFront(self.centerContainerView) self._centerViewController!.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] self.updateShadowForCenterView() @@ -916,7 +916,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { self._centerViewController!.endAppearanceTransition() } - self._centerViewController!.didMove(toParentViewController: self) + self._centerViewController!.didMove(toParent: self) } } } @@ -952,7 +952,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { self.closeDrawer(animated: animated, completion: { (finished) in if forwardAppearanceMethodsToCenterViewController { self.centerViewController!.endAppearanceTransition() - self.centerViewController!.didMove(toParentViewController: self) + self.centerViewController!.didMove(toParent: self) } completion?(finished) @@ -1022,7 +1022,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { }, completion: { (finished) -> Void in if forwardAppearanceMethodsToCenterViewController { self.centerViewController?.endAppearanceTransition() - self.centerViewController?.didMove(toParentViewController: self) + self.centerViewController?.didMove(toParent: self) } sideDrawerViewController?.endAppearanceTransition() @@ -1108,7 +1108,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { // MARK: - Gesture Handlers - func tapGestureCallback(_ tapGesture: UITapGestureRecognizer) { + @objc func tapGestureCallback(_ tapGesture: UITapGestureRecognizer) { if self.openSide != .none && self.animatingDrawer == false { self.closeDrawer(animated: true, completion: { (finished) in if self.gestureCompletionBlock != nil { @@ -1118,7 +1118,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { } } - func panGestureCallback(_ panGesture: UIPanGestureRecognizer) { + @objc func panGestureCallback(_ panGesture: UIPanGestureRecognizer) { switch panGesture.state { case .began: if self.animatingDrawer { @@ -1232,7 +1232,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { self.openDrawerSide(drawerSide, animated: animated, velocity: self.animationVelocity, animationOptions: [], completion: completion) } - fileprivate func openDrawerSide(_ drawerSide: DrawerSide, animated: Bool, velocity: CGFloat, animationOptions options: UIViewAnimationOptions, completion: ((Bool) -> Void)?) { + fileprivate func openDrawerSide(_ drawerSide: DrawerSide, animated: Bool, velocity: CGFloat, animationOptions options: UIView.AnimationOptions, completion: ((Bool) -> Void)?) { assert({ () -> Bool in return drawerSide != .none }(), "drawerSide cannot be .None") @@ -1293,7 +1293,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { self.closeDrawer(animated: animated, velocity: self.animationVelocity, animationOptions: [], completion: completion) } - fileprivate func closeDrawer(animated: Bool, velocity: CGFloat, animationOptions options: UIViewAnimationOptions, completion: ((Bool) -> Void)?) { + fileprivate func closeDrawer(animated: Bool, velocity: CGFloat, animationOptions options: UIView.AnimationOptions, completion: ((Bool) -> Void)?) { if self.animatingDrawer { completion?(false) } else { @@ -1445,7 +1445,7 @@ open class DrawerController: UIViewController, UIGestureRecognizerDelegate { if oldShadowPath != nil { let transition = CABasicAnimation(keyPath: "shadowPath") transition.fromValue = oldShadowPath - transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) transition.duration = context.transitionDuration self.centerContainerView.layer.add(transition, forKey: "transition") }