Refactoring + Merge branch 'pr/399' into 5.0.0
* pr/399: feat: update swift version for all sub-projects (example, pod, etc) to 4.2 feat: update pod swift version to 4.2 feat: update support for swift 4.2 (source and example) # Conflicts: # Pod/Classes/SideMenuManager.swift
This commit is contained in:
commit
cb89d98dd8
6 files changed
+35
-47
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user