diff --git a/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json index 118c98f..19882d5 100644 --- a/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -29,6 +39,11 @@ "idiom" : "iphone", "size" : "60x60", "scale" : "3x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Pod/Classes/SideMenuGestureManager.swift b/Pod/Classes/SideMenuGestureManager.swift deleted file mode 100644 index 67b7d5b..0000000 --- a/Pod/Classes/SideMenuGestureManager.swift +++ /dev/null @@ -1,199 +0,0 @@ -// -// SideMenuGestureManager.swift -// SideMenu -// -// Created by Jon Kent on 12/9/18. -// - -import UIKit - -internal protocol SideMenuGestureManagerDelegate: class { - func gestureManagerWidthForMenu(_ gestureManager: SideMenuGestureManager) -> CGFloat? - func gestureManager(_ gestureManager: SideMenuGestureManager, changedState state: SideMenuGestureManager.State, presenting: Bool) -} - -internal class SideMenuGestureManager { - - enum State { case - start(progress: CGFloat), - update(progress: CGFloat), - switching(progress: CGFloat), - finish, - cancel - } - - private(set) var leftSide: Bool = false - private weak var activeGesture: UIPanGestureRecognizer? - - weak var delegate: SideMenuGestureManagerDelegate? - - var isTracking: Bool { - return activeGesture != nil - } - - func addPresentScreenEdgePanGestures(to view: UIView, for sides: [UIRectEdge] = [.left, .right]) -> [UIScreenEdgePanGestureRecognizer] { - return sides.map { edge in - let gesture = addScreenEdgeGesture(toView: view, edge: edge) - gesture.addTarget(self, action:#selector(handlePresentMenuScreenEdge(_:))) - return gesture - } - } - - @discardableResult func addPresentPanGesture(to view: UIView) -> UIPanGestureRecognizer { - let panGestureRecognizer = UIPanGestureRecognizer() - panGestureRecognizer.addTarget(self, action:#selector(handlePresentMenuPan(_:))) - view.addGestureRecognizer(panGestureRecognizer) - return panGestureRecognizer - } - - @discardableResult func addDismissPanGesture(to view: UIView) -> UIPanGestureRecognizer { - let panGestureRecognizer = UIPanGestureRecognizer() - panGestureRecognizer.cancelsTouchesInView = false - panGestureRecognizer.addTarget(self, action:#selector(handleDismissMenuPan(_:))) - view.addGestureRecognizer(panGestureRecognizer) - return panGestureRecognizer - } - - func addDismissGestures(to view: UIView?) { - guard let view = view else { return } - - addDismissPanGesture(to: view) - - let tapGestureRecognizer = UITapGestureRecognizer() - tapGestureRecognizer.addTarget(self, action: #selector(handleDismissMenuTap(_:))) - view.addGestureRecognizer(tapGestureRecognizer) - } -} - -private extension SideMenuGestureManager { - - var width: CGFloat { - return delegate?.gestureManagerWidthForMenu(self) ?? 0 - } - - func factor(_ presenting: Bool) -> CGFloat { - return presenting ? presentFactor : hideFactor - } - - var presentFactor: CGFloat { - return leftSide ? 1 : -1 - } - - var hideFactor: CGFloat { - return -presentFactor - } - - @objc func handlePresentMenuScreenEdge(_ gesture: UIScreenEdgePanGestureRecognizer) { - handleMenuPan(gesture, presenting: true) - } - - @objc func handleDismissMenuTap(_ tap: UITapGestureRecognizer) { - guard let delegate = delegate else { return } - delegate.gestureManager(self, changedState: .finish, presenting: false) - } - - @objc func handlePresentMenuPan(_ gesture: UIPanGestureRecognizer) { - handleMenuPan(gesture, presenting: true) - } - - @objc func handleDismissMenuPan(_ gesture: UIPanGestureRecognizer) { - handleMenuPan(gesture, presenting: false) - } - - func addScreenEdgeGesture(toView: UIView, edge: UIRectEdge) -> UIScreenEdgePanGestureRecognizer { - let screenEdgeGestureRecognizer = UIScreenEdgePanGestureRecognizer() - screenEdgeGestureRecognizer.cancelsTouchesInView = true - screenEdgeGestureRecognizer.edges = edge - toView.addGestureRecognizer(screenEdgeGestureRecognizer) - return screenEdgeGestureRecognizer - } - - func handleMenuPan(_ gesture: UIPanGestureRecognizer, presenting: Bool) { - guard let delegate = delegate else { return } - - if activeGesture == nil { - if presenting { - if let gesture = gesture as? UIScreenEdgePanGestureRecognizer { - leftSide = gesture.edges.contains(.left) - } else { - // not sure which way the user is swiping yet, so do nothing - if gesture.xTranslation == 0 { return } - leftSide = gesture.xTranslation > 0 - } - } - - activeGesture = gesture - } else if gesture != activeGesture { - gesture.isEnabled = false - gesture.isEnabled = true - return - } - - let distance = gesture.xTranslation / width - let progress = max(min(distance * factor(presenting), 1), 0) - switch (gesture.state) { - case .began: - delegate.gestureManager(self, changedState: .start(progress: progress), presenting: presenting) - case .changed: - if presenting && gesture.canSwitch { - let switching = (distance > 0 && !leftSide) || (distance < 0 && leftSide) - if switching { - leftSide = !leftSide - delegate.gestureManager(self, changedState: .switching(progress: progress), presenting: presenting) - return - } - } - delegate.gestureManager(self, changedState: .update(progress: progress), presenting: presenting) - default: - let velocity = gesture.xVelocity * factor(presenting) - let finished = velocity >= 100 || velocity >= -50 && abs(distance) >= 0.5 - delegate.gestureManager(self, changedState: finished ? .finish : .cancel, presenting: presenting) - self.activeGesture = nil - } - } -} - -private extension UIPanGestureRecognizer { - - var canSwitch: Bool { - return !(self is UIScreenEdgePanGestureRecognizer) - } - - var presentDirection: SideMenuManager.PresentDirection { - return xTranslation > 0 ? .left : .right - } - - var xTranslation: CGFloat { - return view?.untransform { - return self.translation(in: view).x - } ?? 0 - } - - var xVelocity: CGFloat { - return view?.untransform { - return self.velocity(in: view).x - } ?? 0 - } -} - -internal extension UIView { - - @discardableResult func untransform(_ code: () -> CGFloat) -> CGFloat { - let transform = self.transform - self.transform = .identity - let value = code() - self.transform = transform - return value - } - - func untransform(_ code: () -> Void) { - untransform { () -> CGFloat in - code() - return 0 - } - } - - func bringToFront() { - self.superview?.bringSubviewToFront(self) - } -} diff --git a/Pod/Classes/SideMenuInteractionController.swift b/Pod/Classes/SideMenuInteractionController.swift index 94ed8a7..f160313 100644 --- a/Pod/Classes/SideMenuInteractionController.swift +++ b/Pod/Classes/SideMenuInteractionController.swift @@ -7,8 +7,19 @@ import UIKit +internal protocol SideMenuInteractable { + func handle(state: SideMenuInteractionController.State) +} + internal class SideMenuInteractionController: UIPercentDrivenInteractiveTransition { + internal enum State { case + update(progress: CGFloat), + switching(progress: CGFloat), + finish, + cancel + } + private(set) var isCancelled: Bool = false private(set) var isFinished: Bool = false @@ -32,3 +43,17 @@ internal class SideMenuInteractionController: UIPercentDrivenInteractiveTransiti super.update(percentComplete) } } + +extension SideMenuInteractionController: SideMenuInteractable { + + func handle(state: State) { + switch state { + case .update(let progress): + update(progress) + case .finish: + finish() + case .switching, .cancel: + cancel() + } + } +} diff --git a/Pod/Classes/SideMenuManager.swift b/Pod/Classes/SideMenuManager.swift index 7fd2bb9..6c47267 100644 --- a/Pod/Classes/SideMenuManager.swift +++ b/Pod/Classes/SideMenuManager.swift @@ -40,6 +40,10 @@ open class SideMenuManager: NSObject { } } + private weak var activeGesture: UIPanGestureRecognizer? + private weak var switchToMenu: Menu? + private(set) var leftSide: Bool = false + /** The push style of the menu. @@ -155,27 +159,7 @@ open class SideMenuManager: NSObject { return SideMenuManager.default } - internal lazy var gestureManager: SideMenuGestureManager = { - let gestureManager = SideMenuGestureManager() - gestureManager.delegate = self - return gestureManager - }() - private var rotating: Bool = false - private weak var switchToMenu: Menu? - - override init() { - super.init() - let notificationNames: [NSNotification.Name] = [ - UIApplication.didEnterBackgroundNotification, - UIApplication.willChangeStatusBarOrientationNotification, - UIApplication.didChangeStatusBarOrientationNotification, - UIApplication.willChangeStatusBarFrameNotification - ] - notificationNames.forEach { - NotificationCenter.default.addObserver(self, selector:#selector(handleNotification), name: $0, object: nil) - } - } /** The blur effect style of the menu if the menu's root view controller is a UITableViewController or UICollectionViewController. @@ -247,7 +231,7 @@ open class SideMenuManager: NSObject { } let edges: [UIRectEdge] = sides.map { $0.edge } - return gestureManager.addPresentScreenEdgePanGestures(to: view, for: edges) + return addPresentScreenEdgePanGestures(to: view, for: edges) } /** @@ -262,7 +246,7 @@ open class SideMenuManager: NSObject { Print.warning(.panGestureAdded, arguments: #function, PresentDirection.left.name, PresentDirection.right.name, required: true) } - return gestureManager.addPresentPanGesture(to: view) + return addPresentPanGesture(to: view) } } @@ -270,7 +254,7 @@ extension SideMenuManager: SideMenuTransitionControllerDelegate { internal func sideMenuTransitionController(_ transitionController: SideMenuTransitionController, animationEnded transitionCompleted: Bool) { if transitionController.presenting && transitionCompleted { - gestureManager.addDismissGestures(to: transitionController.tapView) + addDismissGestures(to: transitionController.tapView) return } @@ -281,47 +265,6 @@ extension SideMenuManager: SideMenuTransitionControllerDelegate { } } -extension SideMenuManager: SideMenuGestureManagerDelegate { - - internal func gestureManager(_ gestureManager: SideMenuGestureManager, changedState state: SideMenuGestureManager.State, presenting: Bool) { - guard gestureManager.isTracking else { - if presenting { - guard let menu = menu(forLeftSide: gestureManager.leftSide) else { return } - SideMenuManager.visibleViewController?.present(menu, animated: true, completion: nil) - } else { - activeMenu?.dismiss(animated: true, completion: nil) - } - return - } - - switch state { - case .start(let progress): - if presenting { - guard let menu = menu(forLeftSide: gestureManager.leftSide) else { return } - SideMenuManager.visibleViewController?.present(menu, animated: true, completion: nil) - } else { - activeMenu?.dismiss(animated: true, completion: nil) - } - activeMenu?.transitionController?.interactionController?.update(progress) - case .update(let progress): - activeMenu?.transitionController?.interactionController?.update(progress) - case .switching: - switchToMenu = menu(forLeftSide: gestureManager.leftSide) - activeMenu?.transitionController?.interactionController?.cancel() - case .finish: - switchToMenu = nil - activeMenu?.transitionController?.interactionController?.finish() - case .cancel: - switchToMenu = nil - activeMenu?.transitionController?.interactionController?.cancel() - } - } - - internal func gestureManagerWidthForMenu(_ gestureManager: SideMenuGestureManager) -> CGFloat? { - return menu(forLeftSide: gestureManager.leftSide)?.menuWidth - } -} - internal extension SideMenuManager { func setMenu(_ menu: Menu?, forLeftSide leftSide: Bool) { @@ -330,10 +273,135 @@ internal extension SideMenuManager { case false: menuRightNavigationController = menu } } + + var isTracking: Bool { + return activeGesture != nil + } + + func addPresentScreenEdgePanGestures(to view: UIView, for sides: [UIRectEdge] = [.left, .right]) -> [UIScreenEdgePanGestureRecognizer] { + return sides.map { edge in + let gesture = addScreenEdgeGesture(toView: view, edge: edge) + gesture.addTarget(self, action:#selector(handlePresentMenuScreenEdge(_:))) + return gesture + } + } + + @discardableResult func addPresentPanGesture(to view: UIView) -> UIPanGestureRecognizer { + let panGestureRecognizer = UIPanGestureRecognizer() + panGestureRecognizer.addTarget(self, action:#selector(handlePresentMenuPan(_:))) + view.addGestureRecognizer(panGestureRecognizer) + return panGestureRecognizer + } + + @discardableResult func addDismissPanGesture(to view: UIView) -> UIPanGestureRecognizer { + let panGestureRecognizer = UIPanGestureRecognizer() + panGestureRecognizer.cancelsTouchesInView = false + panGestureRecognizer.addTarget(self, action:#selector(handleDismissMenuPan(_:))) + view.addGestureRecognizer(panGestureRecognizer) + return panGestureRecognizer + } + + func + addDismissGestures(to view: UIView?) { + guard let view = view else { return } + + addDismissPanGesture(to: view) + + let tapGestureRecognizer = UITapGestureRecognizer() + tapGestureRecognizer.addTarget(self, action: #selector(handleDismissMenuTap(_:))) + view.addGestureRecognizer(tapGestureRecognizer) + } } private extension SideMenuManager { + func factor(_ presenting: Bool) -> CGFloat { + return presenting ? presentFactor : hideFactor + } + + var presentFactor: CGFloat { + return leftSide ? 1 : -1 + } + + var hideFactor: CGFloat { + return -presentFactor + } + + @objc func handlePresentMenuScreenEdge(_ gesture: UIScreenEdgePanGestureRecognizer) { + handleMenuPan(gesture, presenting: true) + } + + @objc func handlePresentMenuPan(_ gesture: UIPanGestureRecognizer) { + handleMenuPan(gesture, presenting: true) + } + + @objc func handleDismissMenuTap(_ tap: UITapGestureRecognizer) { + activeMenu?.dismiss(animated: true, completion: nil) + } + + @objc func handleDismissMenuPan(_ gesture: UIPanGestureRecognizer) { + handleMenuPan(gesture, presenting: false) + } + + func addScreenEdgeGesture(toView: UIView, edge: UIRectEdge) -> UIScreenEdgePanGestureRecognizer { + let screenEdgeGestureRecognizer = UIScreenEdgePanGestureRecognizer() + screenEdgeGestureRecognizer.cancelsTouchesInView = true + screenEdgeGestureRecognizer.edges = edge + toView.addGestureRecognizer(screenEdgeGestureRecognizer) + return screenEdgeGestureRecognizer + } + + func handleMenuPan(_ gesture: UIPanGestureRecognizer, presenting: Bool) { + if activeGesture == nil { + if presenting { + if let gesture = gesture as? UIScreenEdgePanGestureRecognizer { + leftSide = gesture.edges.contains(.left) + } else { + // not sure which way the user is swiping yet, so do nothing + if gesture.xTranslation == 0 { return } + leftSide = gesture.xTranslation > 0 + } + } + + activeGesture = gesture + } else if gesture != activeGesture { + gesture.isEnabled = false + gesture.isEnabled = true + return + } + + let width = menu(forLeftSide: leftSide)?.menuWidth ?? 0 + let distance = gesture.xTranslation / width + let progress = max(min(distance * factor(presenting), 1), 0) + switch (gesture.state) { + case .began: + if presenting { + guard let menu = menu(forLeftSide: leftSide) else { return } + SideMenuManager.visibleViewController?.present(menu, animated: true, completion: nil) + } else { + activeMenu?.dismiss(animated: true, completion: nil) + } + activeMenu?.handle(state: .update(progress: progress)) + case .changed: + if presenting && gesture.canSwitch { + let switching = (distance > 0 && !leftSide) || (distance < 0 && leftSide) + if switching { + leftSide = !leftSide + switchToMenu = menu(forLeftSide: leftSide) + activeMenu?.handle(state: .switching(progress: progress)) + return + } + } + activeMenu?.handle(state: .update(progress: progress)) + default: + switchToMenu = nil + activeGesture = nil + let velocity = gesture.xVelocity * factor(presenting) + let finished = velocity >= 100 || velocity >= -50 && abs(distance) >= 0.5 + activeMenu?.handle(state: finished ? .finish : .cancel) + } + } + var activeMenu: Menu? { if menuLeftNavigationController?.isHidden == false { return menuLeftNavigationController } if menuRightNavigationController?.isHidden == false { return menuRightNavigationController } @@ -392,37 +460,15 @@ private extension SideMenuManager { } func setupSwipeGestures() { - forEachMenu { - if let swipeToDismissGesture = $0.swipeToDismissGesture, !$0.enableSwipeGestures { + forEachMenu { menu in + if let swipeToDismissGesture = menu.swipeToDismissGesture, !menu.enableSwipeGestures { swipeToDismissGesture.view?.removeGestureRecognizer(swipeToDismissGesture) - } else if $0.swipeToDismissGesture == nil && $0.enableSwipeGestures { - $0.swipeToDismissGesture = gestureManager.addDismissPanGesture(to: $0.view) + } else if menu.swipeToDismissGesture == nil && menu.enableSwipeGestures { + menu.swipeToDismissGesture = addDismissPanGesture(to: menu.view) } } } - @objc func handleNotification(notification: NSNotification) { - guard let activeMenu = activeMenu, activeMenu.presentedViewController == nil else { return } - - switch notification.name { - case UIApplication.didEnterBackgroundNotification: - if activeMenu.dismissWhenBackgrounded { - activeMenu.transitionController?.interactionController?.cancel() - activeMenu.dismiss(animated: false, completion: nil) - } - return - case UIApplication.willChangeStatusBarOrientationNotification: - rotating = true - case UIApplication.didChangeStatusBarOrientationNotification: - rotating = false - case UIApplication.willChangeStatusBarFrameNotification: - if !rotating { - activeMenu.dismiss(animated: true, completion: nil) - } - default: break - } - } - class var visibleViewController: UIViewController? { return getVisibleViewController(forViewController: UIApplication.shared.keyWindow?.rootViewController) } @@ -445,6 +491,51 @@ private extension SideMenuManager { } } +private extension UIPanGestureRecognizer { + + var canSwitch: Bool { + return !(self is UIScreenEdgePanGestureRecognizer) + } + + var presentDirection: SideMenuManager.PresentDirection { + return xTranslation > 0 ? .left : .right + } + + var xTranslation: CGFloat { + return view?.untransform { + return self.translation(in: view).x + } ?? 0 + } + + var xVelocity: CGFloat { + return view?.untransform { + return self.velocity(in: view).x + } ?? 0 + } +} + +internal extension UIView { + + @discardableResult func untransform(_ code: () -> CGFloat) -> CGFloat { + let transform = self.transform + self.transform = .identity + let value = code() + self.transform = transform + return value + } + + func untransform(_ code: () -> Void) { + untransform { () -> CGFloat in + code() + return 0 + } + } + + func bringToFront() { + self.superview?.bringSubviewToFront(self) + } +} + //extension SideMenuManager: MenuOptions { // var allowPushOfSameClassTwice: Bool { // <#code#> diff --git a/Pod/Classes/SideMenuTransitionController.swift b/Pod/Classes/SideMenuTransitionController.swift index 4683216..bea753f 100644 --- a/Pod/Classes/SideMenuTransitionController.swift +++ b/Pod/Classes/SideMenuTransitionController.swift @@ -15,20 +15,15 @@ internal class SideMenuTransitionController: NSObject, UIViewControllerAnimatedT internal weak var tapView: UIView? internal var interactive: Bool = false - internal var options: Menu.Options + private unowned var menu: Menu internal var delegate: SideMenuTransitionControllerDelegate? - internal lazy var interactionController: SideMenuInteractionController? = { - guard interactive else { return nil } - return SideMenuInteractionController(completionCurve: options.completionCurve) - }() - private(set) var presenting: Bool = true private var transitioning = false private weak var containerView: UIView? private var presentationController: SideMenuPresentationController! - init(options: Menu.Options) { - self.options = options + init(menu: Menu) { + self.menu = menu } deinit { @@ -39,22 +34,20 @@ internal class SideMenuTransitionController: NSObject, UIViewControllerAnimatedT open func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { guard let toViewController = transitionContext.viewController(forKey: .to), - let fromViewController = transitionContext.viewController(forKey: .from), - let menu = (toViewController as? Menu) ?? (fromViewController as? Menu) + let fromViewController = transitionContext.viewController(forKey: .from) else { return } menu.sideMenuManagerDelegate = self - options = menu.options let presentingViewController = menu == toViewController ? fromViewController : toViewController containerView = transitionContext.containerView if presenting { - presentationController = SideMenuPresentationController(style: options.presentStyle, + presentationController = SideMenuPresentationController(style: menu.options.presentStyle, presented: menu, presenting: presentingViewController, containerView: transitionContext.containerView, - presentingUserInteractionEnabled: options.presentingViewControllerUserInteractionEnabled, - presentingViewControllerUseSnapshot: options.presentingViewControllerUseSnapshot) + presentingUserInteractionEnabled: menu.options.presentingViewControllerUserInteractionEnabled, + presentingViewControllerUseSnapshot: menu.options.presentingViewControllerUseSnapshot) } transition(using: transitionContext) @@ -237,8 +230,8 @@ extension SideMenuTransitionController: UISideMenuNavigationControllerManagerDel private extension SideMenuTransitionController { var duration: Double { - if interactive { return options.completeGestureDuration } - return presenting ? options.presentDuration : options.dismissDuration + if interactive { return menu.options.completeGestureDuration } + return presenting ? menu.options.presentDuration : menu.options.dismissDuration } func transition(animated: Bool = true, alongsideTransition: (() -> Void)? = nil, completion: ((Bool) -> Void)? = nil, using transitionContext: UIViewControllerContextTransitioning? = nil) { @@ -296,9 +289,9 @@ private extension SideMenuTransitionController { UIView.animate( withDuration: duration, delay: 0, - usingSpringWithDamping: options.usingSpringWithDamping, - initialSpringVelocity: options.initialSpringVelocity, - options: options.animationOptions, + usingSpringWithDamping: menu.options.usingSpringWithDamping, + initialSpringVelocity: menu.options.initialSpringVelocity, + options: menu.options.animationOptions, animations: animations, completion: completion ) diff --git a/Pod/Classes/UISideMenuNavigationController.swift b/Pod/Classes/UISideMenuNavigationController.swift index 20257ea..01ba675 100644 --- a/Pod/Classes/UISideMenuNavigationController.swift +++ b/Pod/Classes/UISideMenuNavigationController.swift @@ -45,7 +45,7 @@ internal protocol MenuOptions { @objc optional func sideMenuDidDisappear(menu: UISideMenuNavigationController, animated: Bool) } -internal protocol UISideMenuNavigationControllerManagerDelegate: UISideMenuNavigationControllerDelegate { +internal protocol UISideMenuNavigationControllerManagerDelegate: class { func sideMenuWillAppear(menu: UISideMenuNavigationController, animated: Bool) -> Bool func sideMenuDidAppear(menu: UISideMenuNavigationController, animated: Bool) -> Bool func sideMenuWillDisappear(menu: UISideMenuNavigationController, animated: Bool) -> Bool @@ -105,15 +105,18 @@ open class UISideMenuNavigationController: UINavigationController { internal weak var sideMenuManagerDelegate: UISideMenuNavigationControllerManagerDelegate? internal var originalBackgroundColor: UIColor? - internal var transitionController: SideMenuTransitionController? private weak var foundDelegate: UISideMenuNavigationControllerDelegate? + private weak var interactionController: SideMenuInteractionController? private var _options: Options? private lazy var _leftSide = Protected(false, if: condition, else: { _ in Menu.elseCondition(.leftSide) } ) + private var _sideMenuManager: SideMenuManager? + private var transitionController: SideMenuTransitionController? + private var rotating: Bool = false open var sideMenuManager: SideMenuManager { - get { return transitioningDelegate as? SideMenuManager ?? SideMenuManager.default } -// set { transitioningDelegate = newValue } + get { return _sideMenuManager ?? SideMenuManager.default } + set { _sideMenuManager = newValue } } #if !STFU_SIDEMENU @@ -125,14 +128,14 @@ open class UISideMenuNavigationController: UINavigationController { fatalError("init is not available") } - public override init(rootViewController: UIViewController) { - super.init(rootViewController: rootViewController) - } - - public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { - super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) - } - +// public override init(rootViewController: UIViewController) { +// super.init(rootViewController: rootViewController) +// } +// +// public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { +// super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) +// } +// public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } @@ -156,6 +159,8 @@ open class UISideMenuNavigationController: UINavigationController { override open func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + registerForNotifications() + guard sideMenuManagerDelegate?.sideMenuDidAppear(menu: self, animated: animated) == true else { return } activeDelegate?.sideMenuDidAppear?(menu: self, animated: animated) } @@ -206,15 +211,15 @@ open class UISideMenuNavigationController: UINavigationController { extension UISideMenuNavigationController: UIViewControllerTransitioningDelegate { open func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? { - guard let menu = presented as? UISideMenuNavigationController else { return nil } - transitionController = SideMenuTransitionController(options: menu.options) - transitionController?.interactive = sideMenuManager.gestureManager.isTracking + guard let menu = presented as? Menu else { return nil } + transitionController = SideMenuTransitionController(menu: menu) + transitionController?.interactive = sideMenuManager.isTracking transitionController?.delegate = sideMenuManager return transitionController } open func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? { - transitionController?.interactive = sideMenuManager.gestureManager.isTracking + transitionController?.interactive = sideMenuManager.isTracking return transitionController } @@ -227,8 +232,19 @@ extension UISideMenuNavigationController: UIViewControllerTransitioningDelegate } open func interactionController(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? { + guard sideMenuManager.isTracking else { return nil } + let interactionController = SideMenuInteractionController(completionCurve: options.completionCurve) + self.interactionController = interactionController let transitionController = animator as? SideMenuTransitionController - return transitionController?.interactionController + transitionController?.interactive = true + return interactionController + } +} + +extension UISideMenuNavigationController: SideMenuInteractable { + + func handle(state: SideMenuInteractionController.State) { + interactionController?.handle(state: state) } } @@ -378,10 +394,42 @@ internal extension UISideMenuNavigationController { guard !view.isHidden else { return nil } return sideMenuDelegate ?? foundDelegate ?? findDelegate(forViewController: presentingViewController) } + + @objc func handleNotification(notification: NSNotification) { + guard presentedViewController == nil else { return } + + switch notification.name { + case UIApplication.didEnterBackgroundNotification: + if dismissWhenBackgrounded { + interactionController?.cancel() + dismiss(animated: false, completion: nil) + } + return + case UIApplication.willChangeStatusBarOrientationNotification: + rotating = true + case UIApplication.didChangeStatusBarOrientationNotification: + rotating = false + case UIApplication.willChangeStatusBarFrameNotification: + if !rotating { + dismiss(animated: true, completion: nil) + } + default: break + } + } } private extension UISideMenuNavigationController { + func registerForNotifications() { + [UIApplication.didEnterBackgroundNotification, + UIApplication.willChangeStatusBarOrientationNotification, + UIApplication.didChangeStatusBarOrientationNotification, + UIApplication.willChangeStatusBarFrameNotification + ].forEach { + NotificationCenter.default.addObserver(self, selector:#selector(handleNotification), name: $0, object: nil) + } + } + func condition() -> Bool { return isHidden } @@ -450,5 +498,3 @@ private extension UISideMenuNavigationController { } } } - - diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj index 5d702db..6ebcf51 100644 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -15,8 +15,6 @@ 6672CE381BB9B1A0D633B5E98E9A412E /* Print.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC20F98687A109E1FDAD74BC62911299 /* Print.swift */; }; 7CFEB3863F8BB185CD0E835E302E229C /* UISideMenuNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E69DF5906E981028F065B72E0F0C227 /* UISideMenuNavigationController.swift */; }; 84241FB721D6CB50002D4862 /* SideMenuInteractionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84241FB621D6CB50002D4862 /* SideMenuInteractionController.swift */; }; - 84241FB921D7FCA2002D4862 /* SideMenuGestureManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84241FB821D7FCA2002D4862 /* SideMenuGestureManager.swift */; }; - 84241FBB21D81885002D4862 /* SideMenuPresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84241FBA21D81885002D4862 /* SideMenuPresentable.swift */; }; 8436EF15220EE97800A8861A /* Protected.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8436EF14220EE97800A8861A /* Protected.swift */; }; 8BC8C3FB652840612047B49E8D4B3B44 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6DFF15000AFE2A371BF499E7AFDA808 /* Foundation.framework */; }; B912EBCBB29DDE29695D0E58BC145396 /* SideMenuTransitionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 383C67B923116765AC95EC08436448D4 /* SideMenuTransitionController.swift */; }; @@ -49,8 +47,6 @@ 6928960C76E1B7820688E60500A05DFD /* SideMenu-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SideMenu-dummy.m"; sourceTree = ""; }; 6E69DF5906E981028F065B72E0F0C227 /* UISideMenuNavigationController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UISideMenuNavigationController.swift; path = Pod/Classes/UISideMenuNavigationController.swift; sourceTree = ""; }; 84241FB621D6CB50002D4862 /* SideMenuInteractionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuInteractionController.swift; path = Pod/Classes/SideMenuInteractionController.swift; sourceTree = ""; }; - 84241FB821D7FCA2002D4862 /* SideMenuGestureManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuGestureManager.swift; path = Pod/Classes/SideMenuGestureManager.swift; sourceTree = ""; }; - 84241FBA21D81885002D4862 /* SideMenuPresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideMenuPresentable.swift; sourceTree = ""; }; 8436EF14220EE97800A8861A /* Protected.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Protected.swift; path = Pod/Classes/Protected.swift; sourceTree = ""; }; 8B22924AF0FECF030E052A8783CA4120 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8B278378E8AE995FBE26E513BED2DB8E /* Pods-Example-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Example-Info.plist"; sourceTree = ""; }; @@ -96,13 +92,11 @@ DC20F98687A109E1FDAD74BC62911299 /* Print.swift */, 8436EF14220EE97800A8861A /* Protected.swift */, 61E50E81F13B12673E4A96C971B6DFC7 /* SideMenuManager.swift */, - 84241FB821D7FCA2002D4862 /* SideMenuGestureManager.swift */, FECF363D37A4A8B719135B1848C02CD4 /* SideMenuPresentationController.swift */, 383C67B923116765AC95EC08436448D4 /* SideMenuTransitionController.swift */, 84241FB621D6CB50002D4862 /* SideMenuInteractionController.swift */, 6E69DF5906E981028F065B72E0F0C227 /* UISideMenuNavigationController.swift */, A5362C3E90D0411B7A1153811DEFA8E4 /* UITableViewVibrantCell.swift */, - 84241FBA21D81885002D4862 /* SideMenuPresentable.swift */, 8FA2C91F7C098E55AD6C36A44D885E67 /* Pod */, 9F412C3C9DC9016F76368C6285235102 /* Support Files */, ); @@ -276,6 +270,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 7DB346D0F39D3F0E887471402A8071AB; @@ -315,8 +310,6 @@ 84241FB721D6CB50002D4862 /* SideMenuInteractionController.swift in Sources */, BD3D0DAA6FBD9D2E54C807C55E287223 /* SideMenu-dummy.m in Sources */, 8436EF15220EE97800A8861A /* Protected.swift in Sources */, - 84241FBB21D81885002D4862 /* SideMenuPresentable.swift in Sources */, - 84241FB921D7FCA2002D4862 /* SideMenuGestureManager.swift in Sources */, D3B1E46DFEE3C36D413C60BA994895F7 /* SideMenuManager.swift in Sources */, 5365F93B3E5F4D3D9E1DA2EDCAF7F93B /* SideMenuPresentationController.swift in Sources */, B912EBCBB29DDE29695D0E58BC145396 /* SideMenuTransitionController.swift in Sources */, @@ -404,7 +397,6 @@ STRIP_INSTALLED_PRODUCT = NO; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; SYMROOT = "${SRCROOT}/../build"; }; name = Debug; @@ -503,7 +495,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -536,7 +528,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -597,7 +589,6 @@ PRODUCT_NAME = "$(TARGET_NAME)"; STRIP_INSTALLED_PRODUCT = NO; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; SYMROOT = "${SRCROOT}/../build"; }; name = Release; diff --git a/SideMenu.podspec b/SideMenu.podspec index 4ceddb4..00db752 100644 --- a/SideMenu.podspec +++ b/SideMenu.podspec @@ -29,7 +29,7 @@ Pod::Spec.new do |s| # s.social_media_url = 'https://twitter.com/' s.ios.deployment_target = '10.0' - s.swift_version = '4.2' + s.swift_version = '5' s.source_files = 'Pod/Classes/**/*' # s.resource_bundles = { diff --git a/SideMenu.xcodeproj/project.pbxproj b/SideMenu.xcodeproj/project.pbxproj index 8e91fc9..895f7e6 100644 --- a/SideMenu.xcodeproj/project.pbxproj +++ b/SideMenu.xcodeproj/project.pbxproj @@ -15,17 +15,17 @@ 7B48A0F81DCB2518002990A1 /* SideMenuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B48A0F51DCB2518002990A1 /* SideMenuTableViewController.swift */; }; 7B552D5D1DCC65830010301C /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B552D5C1DCC65830010301C /* Launch Screen.storyboard */; }; 7B5FA9B61DCB269700278DF6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B5FA9B51DCB269700278DF6 /* Main.storyboard */; }; + 84276D8A2282929A0095B7C5 /* SideMenuManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84276D892282929A0095B7C5 /* SideMenuManager.swift */; }; 842A45B821BE342A00768381 /* Print.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842A45B721BE342A00768381 /* Print.swift */; }; 842F058D21994F6200558233 /* SideMenuPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842F058C21994F6100558233 /* SideMenuPresentationController.swift */; }; 8436EF0F220EE36F00A8861A /* SideMenuInteractionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8436EF0E220EE36F00A8861A /* SideMenuInteractionController.swift */; }; - 8461A2D31E145A08001DA4F8 /* SideMenuManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8461A2CF1E145A08001DA4F8 /* SideMenuManager.swift */; }; 8461A2D51E145A08001DA4F8 /* UISideMenuNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8461A2D11E145A08001DA4F8 /* UISideMenuNavigationController.swift */; }; 8461A2D61E145A08001DA4F8 /* UITableViewVibrantCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8461A2D21E145A08001DA4F8 /* UITableViewVibrantCell.swift */; }; - 846B947A21E006BB00D795AA /* SideMenuGestureManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846B947921E006BB00D795AA /* SideMenuGestureManager.swift */; }; 848B96482192F10E005E6712 /* SideMenuTransitionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848B96472192F10E005E6712 /* SideMenuTransitionController.swift */; }; 84B489B51DD469B000D6CB43 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 84B489B21DD469B000D6CB43 /* LICENSE */; }; 84B489B71DD469B000D6CB43 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 84B489B41DD469B000D6CB43 /* README.md */; }; 84B489BA1DD469DA00D6CB43 /* SideMenu.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 84B489B91DD469DA00D6CB43 /* SideMenu.podspec */; }; + 84E2116F227C283B002A933B /* Protected.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E2116E227C283B002A933B /* Protected.swift */; }; ACD6DAED90DE36FEA68CDF38 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47896ABC5C8830D88945A8D3 /* Pods_Example.framework */; }; /* End PBXBuildFile section */ @@ -47,17 +47,17 @@ 7B552D5C1DCC65830010301C /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 7B5FA9B51DCB269700278DF6 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 7B9DC9041DC6E8C1000D4007 /* SideMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SideMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 84276D892282929A0095B7C5 /* SideMenuManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuManager.swift; path = Pod/Classes/SideMenuManager.swift; sourceTree = ""; }; 842A45B721BE342A00768381 /* Print.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Print.swift; path = Pod/Classes/Print.swift; sourceTree = ""; }; 842F058C21994F6100558233 /* SideMenuPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuPresentationController.swift; path = Pod/Classes/SideMenuPresentationController.swift; sourceTree = ""; }; 8436EF0E220EE36F00A8861A /* SideMenuInteractionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuInteractionController.swift; path = Pod/Classes/SideMenuInteractionController.swift; sourceTree = ""; }; - 8461A2CF1E145A08001DA4F8 /* SideMenuManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuManager.swift; path = Pod/Classes/SideMenuManager.swift; sourceTree = ""; }; 8461A2D11E145A08001DA4F8 /* UISideMenuNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UISideMenuNavigationController.swift; path = Pod/Classes/UISideMenuNavigationController.swift; sourceTree = ""; }; 8461A2D21E145A08001DA4F8 /* UITableViewVibrantCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UITableViewVibrantCell.swift; path = Pod/Classes/UITableViewVibrantCell.swift; sourceTree = ""; }; - 846B947921E006BB00D795AA /* SideMenuGestureManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuGestureManager.swift; path = Pod/Classes/SideMenuGestureManager.swift; sourceTree = ""; }; 848B96472192F10E005E6712 /* SideMenuTransitionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SideMenuTransitionController.swift; path = Pod/Classes/SideMenuTransitionController.swift; sourceTree = ""; }; 84B489B21DD469B000D6CB43 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 84B489B41DD469B000D6CB43 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 84B489B91DD469DA00D6CB43 /* SideMenu.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SideMenu.podspec; sourceTree = ""; }; + 84B489B91DD469DA00D6CB43 /* SideMenu.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SideMenu.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 84E2116E227C283B002A933B /* Protected.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Protected.swift; path = Pod/Classes/Protected.swift; sourceTree = ""; }; C5943C005BBB10263AFAC91E /* Pods-ExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleTests/Pods-ExampleTests.debug.xcconfig"; sourceTree = ""; }; C7DA85E73FE6228663AD9236 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; C9E09E1C686BF24AD4976EA7 /* Pods-ExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleTests/Pods-ExampleTests.release.xcconfig"; sourceTree = ""; }; @@ -94,14 +94,14 @@ 65FF1B3F1DE33097007B0845 /* Source */ = { isa = PBXGroup; children = ( + 842A45B721BE342A00768381 /* Print.swift */, + 84E2116E227C283B002A933B /* Protected.swift */, + 8436EF0E220EE36F00A8861A /* SideMenuInteractionController.swift */, + 84276D892282929A0095B7C5 /* SideMenuManager.swift */, 842F058C21994F6100558233 /* SideMenuPresentationController.swift */, 848B96472192F10E005E6712 /* SideMenuTransitionController.swift */, - 846B947921E006BB00D795AA /* SideMenuGestureManager.swift */, - 8461A2CF1E145A08001DA4F8 /* SideMenuManager.swift */, 8461A2D11E145A08001DA4F8 /* UISideMenuNavigationController.swift */, 8461A2D21E145A08001DA4F8 /* UITableViewVibrantCell.swift */, - 8436EF0E220EE36F00A8861A /* SideMenuInteractionController.swift */, - 842A45B721BE342A00768381 /* Print.swift */, 65FF1B3D1DE321D8007B0845 /* SideMenu.h */, ); name = Source; @@ -266,6 +266,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -361,11 +362,11 @@ 8461A2D51E145A08001DA4F8 /* UISideMenuNavigationController.swift in Sources */, 842F058D21994F6200558233 /* SideMenuPresentationController.swift in Sources */, 842A45B821BE342A00768381 /* Print.swift in Sources */, - 846B947A21E006BB00D795AA /* SideMenuGestureManager.swift in Sources */, 8436EF0F220EE36F00A8861A /* SideMenuInteractionController.swift in Sources */, 848B96482192F10E005E6712 /* SideMenuTransitionController.swift in Sources */, + 84276D8A2282929A0095B7C5 /* SideMenuManager.swift in Sources */, + 84E2116F227C283B002A933B /* Protected.swift in Sources */, 8461A2D61E145A08001DA4F8 /* UITableViewVibrantCell.swift in Sources */, - 8461A2D31E145A08001DA4F8 /* SideMenuManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -382,7 +383,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -396,7 +397,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -456,7 +457,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -511,7 +512,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -536,7 +537,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -556,7 +557,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.SideMenu; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/SideMenuPresentable.swift b/SideMenuPresentable.swift deleted file mode 100644 index 7b1d7b2..0000000 --- a/SideMenuPresentable.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// SideMenuPresentable.swift -// SideMenu -// -// Created by Jon Kent on 12/29/18. -// - -import UIKit - -//typealias SideMenuPresentableController = UIViewController & SideMenuPresentable -// -//public protocol SideMenuPresentable { -// var leftSide: Bool { get } -// var menuPresentStyle: MenuPresentStyle { get } -// var menuWidth: CGFloat { get } -// var menuAlwaysAnimate: Bool { get } -// var menuDismissOnPush: Bool { get } -//}