diff --git a/Example/MainViewController.swift b/Example/MainViewController.swift index dd92c02..5983c29 100644 --- a/Example/MainViewController.swift +++ b/Example/MainViewController.swift @@ -42,7 +42,7 @@ class MainViewController: UIViewController { let modes:[SideMenuManager.MenuPresentMode] = [.menuSlideIn, .viewSlideOut, .menuDissolveIn] presentModeSegmentedControl.selectedSegmentIndex = modes.index(of: SideMenuManager.default.menuPresentMode)! - let styles:[UIBlurEffectStyle] = [.dark, .light, .extraLight] + let styles:[UIBlurEffect.Style] = [.dark, .light, .extraLight] if let menuBlurEffectStyle = SideMenuManager.default.menuBlurEffectStyle { blurSegmentControl.selectedSegmentIndex = styles.index(of: menuBlurEffectStyle) ?? 0 } else { @@ -65,7 +65,7 @@ class MainViewController: UIViewController { if segmentControl.selectedSegmentIndex == 0 { SideMenuManager.default.menuBlurEffectStyle = nil } else { - let styles:[UIBlurEffectStyle] = [.dark, .light, .extraLight] + let styles:[UIBlurEffect.Style] = [.dark, .light, .extraLight] SideMenuManager.default.menuBlurEffectStyle = styles[segmentControl.selectedSegmentIndex - 1] } default: break; diff --git a/Pod/Classes/SideMenuManager.swift b/Pod/Classes/SideMenuManager.swift index 64b7a2c..247b0ac 100644 --- a/Pod/Classes/SideMenuManager.swift +++ b/Pod/Classes/SideMenuManager.swift @@ -112,8 +112,8 @@ open class SideMenuManager: NSObject { open var menuFadeStatusBar = true /// The animation options when a menu is displayed. Ignored when displayed with a gesture. - open var menuAnimationOptions: UIViewAnimationOptions = .curveEaseInOut - + open var menuAnimationOptions: UIView.AnimationOptions = .curveEaseInOut + /// Animation curve of the remaining animation when the menu is partially dismissed with gestures. Default is .easeIn. open var menuAnimationCompletionCurve: UIViewAnimationCurve = .easeIn @@ -139,9 +139,7 @@ open class SideMenuManager: NSObject { /// Default instance of SideMenuManager (objective-C). open class var defaultManager: SideMenuManager { - get { - return SideMenuManager.default - } + return SideMenuManager.default } internal var transition: SideMenuTransition! @@ -156,7 +154,7 @@ open class SideMenuManager: NSObject { - Note: If you want cells in a UITableViewController menu to show vibrancy, make them a subclass of UITableViewVibrantCell. */ - open var menuBlurEffectStyle: UIBlurEffectStyle? { + open var menuBlurEffectStyle: UIBlurEffect.Style? { didSet { if oldValue != menuBlurEffectStyle { updateMenuBlurIfNecessary() @@ -296,7 +294,7 @@ open class SideMenuManager: NSObject { guard let forMenu = forMenu, let menuBlurEffectStyle = menuBlurEffectStyle, let view = forMenu.topViewController?.view, - !UIAccessibilityIsReduceTransparencyEnabled() else { + !UIAccessibility.isReduceTransparencyEnabled else { return } diff --git a/Pod/Classes/SideMenuTransition.swift b/Pod/Classes/SideMenuTransition.swift index eaebe00..7979d79 100644 --- a/Pod/Classes/SideMenuTransition.swift +++ b/Pod/Classes/SideMenuTransition.swift @@ -22,20 +22,16 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition { } } fileprivate var menuWidth: CGFloat { - get { - let overriddenWidth = menuViewController?.menuWidth ?? 0 - if overriddenWidth > CGFloat.ulpOfOne { - return overriddenWidth - } - return sideMenuManager.menuWidth + let overriddenWidth = menuViewController?.menuWidth ?? 0 + if overriddenWidth > CGFloat.ulpOfOne { + return overriddenWidth } + return sideMenuManager.menuWidth } internal weak var sideMenuManager: SideMenuManager! internal weak var mainViewController: UIViewController? internal weak var menuViewController: UISideMenuNavigationController? { - get { - return presentDirection == .left ? sideMenuManager.menuLeftNavigationController : sideMenuManager.menuRightNavigationController - } + return presentDirection == .left ? sideMenuManager.menuLeftNavigationController : sideMenuManager.menuRightNavigationController } internal var presentDirection: UIRectEdge = .left internal weak var tapView: UIView? { @@ -67,8 +63,8 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition { required public init(sideMenuManager: SideMenuManager) { super.init() - NotificationCenter.default.addObserver(self, selector:#selector(handleNotification), name: NSNotification.Name.UIApplicationDidEnterBackground, object: nil) - NotificationCenter.default.addObserver(self, selector:#selector(handleNotification), name: NSNotification.Name.UIApplicationWillChangeStatusBarFrame, object: nil) + NotificationCenter.default.addObserver(self, selector:#selector(handleNotification), name: .UIApplicationDidEnterBackground, object: nil) + NotificationCenter.default.addObserver(self, selector:#selector(handleNotification), name: .UIApplicationWillChangeStatusBarFrame, object: nil) self.sideMenuManager = sideMenuManager } @@ -77,9 +73,7 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition { } fileprivate static var visibleViewController: UIViewController? { - get { - return getVisibleViewController(forViewController: UIApplication.shared.keyWindow?.rootViewController) - } + return getVisibleViewController(forViewController: UIApplication.shared.keyWindow?.rootViewController) } fileprivate class func getVisibleViewController(forViewController: UIViewController?) -> UIViewController? { @@ -373,7 +367,7 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition { originalSuperview.addSubview(mainViewController.view) } - if notification.name == NSNotification.Name.UIApplicationDidEnterBackground { + if notification.name == .UIApplicationDidEnterBackground { hideMenuStart().hideMenuComplete() menuViewController?.dismiss(animated: false, completion: nil) return diff --git a/Pod/Classes/UISideMenuNavigationController.swift b/Pod/Classes/UISideMenuNavigationController.swift index 0c6963c..99ab247 100644 --- a/Pod/Classes/UISideMenuNavigationController.swift +++ b/Pod/Classes/UISideMenuNavigationController.swift @@ -19,13 +19,11 @@ open class UISideMenuNavigationController: UINavigationController { fileprivate weak var foundDelegate: UISideMenuNavigationControllerDelegate? fileprivate weak var activeDelegate: UISideMenuNavigationControllerDelegate? { - get { - guard !view.isHidden else { - return nil - } - - return sideMenuDelegate ?? foundDelegate ?? findDelegate(forViewController: presentingViewController) + guard !view.isHidden else { + return nil } + + return sideMenuDelegate ?? foundDelegate ?? findDelegate(forViewController: presentingViewController) } fileprivate func findDelegate(forViewController: UIViewController?) -> UISideMenuNavigationControllerDelegate? { if let navigationController = forViewController as? UINavigationController { @@ -45,9 +43,7 @@ open class UISideMenuNavigationController: UINavigationController { internal var locked = false internal var originalMenuBackgroundColor: UIColor? internal var transition: SideMenuTransition { - get { - return sideMenuManager.transition - } + return sideMenuManager.transition } /// Delegate for receiving appear and disappear related events. If `nil` the visible view controller that displays a `UISideMenuNavigationController` automatically receives these events. @@ -85,9 +81,7 @@ open class UISideMenuNavigationController: UINavigationController { /// Indicates if the menu is anywhere in the view hierarchy, even if covered by another view controller. open var isHidden: Bool { - get { - return self.presentingViewController == nil - } + return presentingViewController == nil } #if !STFU_SIDEMENU @@ -239,11 +233,11 @@ open class UISideMenuNavigationController: UINavigationController { return } - NotificationCenter.default.removeObserver(self.transition, name: NSNotification.Name.UIApplicationWillChangeStatusBarFrame, object: nil) + NotificationCenter.default.removeObserver(self.transition, name: .UIApplicationWillChangeStatusBarFrame, object: nil) coordinator.animate(alongsideTransition: { (context) in self.transition.presentMenuStart() }) { (context) in - NotificationCenter.default.addObserver(self.transition, selector:#selector(SideMenuTransition.handleNotification), name: NSNotification.Name.UIApplicationWillChangeStatusBarFrame, object: nil) + NotificationCenter.default.addObserver(self.transition, selector:#selector(SideMenuTransition.handleNotification), name: changeStatusBarFrameNotificationName, object: nil) } } diff --git a/Pod/Classes/UITableViewVibrantCell.swift b/Pod/Classes/UITableViewVibrantCell.swift index 2ececb7..0f2e775 100644 --- a/Pod/Classes/UITableViewVibrantCell.swift +++ b/Pod/Classes/UITableViewVibrantCell.swift @@ -13,14 +13,14 @@ open class UITableViewVibrantCell: UITableViewCell { fileprivate var vibrancyView:UIVisualEffectView = UIVisualEffectView() fileprivate var vibrancySelectedBackgroundView:UIVisualEffectView = UIVisualEffectView() fileprivate var defaultSelectedBackgroundView:UIView? - open var blurEffectStyle: UIBlurEffectStyle? { + open var blurEffectStyle: UIBlurEffect.Style? { didSet { updateBlur() } } // For registering with UITableView without subclassing otherwise dequeuing instance of the cell causes an exception - public override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -45,7 +45,7 @@ open class UITableViewVibrantCell: UITableViewCell { // shouldn't be needed but backgroundColor is set to white on iPad: backgroundColor = UIColor.clear - if let blurEffectStyle = blurEffectStyle, !UIAccessibilityIsReduceTransparencyEnabled() { + if let blurEffectStyle = blurEffectStyle, !UIAccessibility.isReduceTransparencyEnabled { let blurEffect = UIBlurEffect(style: blurEffectStyle) vibrancyView.effect = UIVibrancyEffect(blurEffect: blurEffect) diff --git a/SideMenu.xcodeproj/project.pbxproj b/SideMenu.xcodeproj/project.pbxproj index 3af61db..b2310ed 100644 --- a/SideMenu.xcodeproj/project.pbxproj +++ b/SideMenu.xcodeproj/project.pbxproj @@ -495,7 +495,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -509,7 +509,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.Example; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -523,7 +523,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.ExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; }; name = Debug; @@ -538,7 +538,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.ExampleTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; }; name = Release; @@ -599,6 +599,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -653,6 +654,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -678,7 +680,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -699,7 +701,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.jonkykong.SideMenu; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; };