diff --git a/SlideMenuControllerSwift.xcodeproj/project.pbxproj b/SlideMenuControllerSwift.xcodeproj/project.pbxproj index b7cc546..070b3c7 100644 --- a/SlideMenuControllerSwift.xcodeproj/project.pbxproj +++ b/SlideMenuControllerSwift.xcodeproj/project.pbxproj @@ -331,11 +331,11 @@ }; C539E6401A315E87003B7CC7 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 1160; }; C539E6581A315E87003B7CC7 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 1160; TestTargetID = C539E6401A315E87003B7CC7; }; }; @@ -345,6 +345,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -487,7 +488,7 @@ PRODUCT_BUNDLE_IDENTIFIER = dekatotoro.SlideMenuControllerSwift; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -512,7 +513,7 @@ PRODUCT_BUNDLE_IDENTIFIER = dekatotoro.SlideMenuControllerSwift; PRODUCT_NAME = "$(PROJECT_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -628,7 +629,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -643,7 +644,7 @@ ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -661,7 +662,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SlideMenuControllerSwift.app/SlideMenuControllerSwift"; }; name = Debug; @@ -675,7 +676,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "dekatotoro.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SlideMenuControllerSwift.app/SlideMenuControllerSwift"; }; name = Release; diff --git a/SlideMenuControllerSwift/AppDelegate.swift b/SlideMenuControllerSwift/AppDelegate.swift index afe18f3..0b25960 100644 --- a/SlideMenuControllerSwift/AppDelegate.swift +++ b/SlideMenuControllerSwift/AppDelegate.swift @@ -37,7 +37,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { self.window?.makeKeyAndVisible() } - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { self.createMenuView() diff --git a/SlideMenuControllerSwift/BaseTableViewCell.swift b/SlideMenuControllerSwift/BaseTableViewCell.swift index 9927cec..2606587 100644 --- a/SlideMenuControllerSwift/BaseTableViewCell.swift +++ b/SlideMenuControllerSwift/BaseTableViewCell.swift @@ -15,7 +15,7 @@ open class BaseTableViewCell : UITableViewCell { setup() } - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) setup() } diff --git a/SlideMenuControllerSwift/LeftViewController.swift b/SlideMenuControllerSwift/LeftViewController.swift index ba71992..337ae34 100644 --- a/SlideMenuControllerSwift/LeftViewController.swift +++ b/SlideMenuControllerSwift/LeftViewController.swift @@ -120,7 +120,7 @@ extension LeftViewController : UITableViewDataSource { if let menu = LeftMenu(rawValue: indexPath.row) { switch menu { case .main, .swift, .java, .go, .nonMenu: - let cell = BaseTableViewCell(style: UITableViewCellStyle.subtitle, reuseIdentifier: BaseTableViewCell.identifier) + let cell = BaseTableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: BaseTableViewCell.identifier) cell.setData(menus[indexPath.row]) return cell } diff --git a/SlideMenuControllerSwift/String.swift b/SlideMenuControllerSwift/String.swift index 61e4045..f0904d8 100644 --- a/SlideMenuControllerSwift/String.swift +++ b/SlideMenuControllerSwift/String.swift @@ -14,10 +14,10 @@ extension String { } func substring(_ from: Int) -> String { - return self.substring(from: self.characters.index(self.startIndex, offsetBy: from)) + return self.substring(from: self.index(self.startIndex, offsetBy: from)) } var length: Int { - return self.characters.count + return self.count } } diff --git a/Source/SlideMenuController.swift b/Source/SlideMenuController.swift index 08bc88c..c0ccf24 100644 --- a/Source/SlideMenuController.swift +++ b/Source/SlideMenuController.swift @@ -29,7 +29,7 @@ public struct SlideMenuOptions { public static var shadowOffset: CGSize = CGSize(width: 0,height: 0) public static var panFromBezel: Bool = true public static var animationDuration: CGFloat = 0.4 - public static var animationOptions: UIViewAnimationOptions = [] + public static var animationOptions: UIView.AnimationOptions = [] public static var rightViewWidth: CGFloat = 270.0 public static var rightBezelWidth: CGFloat? = 16.0 public static var rightPanFromBezel: Bool = true @@ -128,7 +128,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { opacityframe.size.height = opacityframe.size.height - opacityOffset opacityView = UIView(frame: opacityframe) opacityView.backgroundColor = SlideMenuOptions.opacityViewBackgroundColor - opacityView.autoresizingMask = [UIViewAutoresizing.flexibleHeight, UIViewAutoresizing.flexibleWidth] + opacityView.autoresizingMask = [UIView.AutoresizingMask.flexibleHeight, UIView.AutoresizingMask.flexibleWidth] opacityView.layer.opacity = 0.0 view.insertSubview(opacityView, at: 1) @@ -141,7 +141,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { leftFrame.size.height = leftFrame.size.height - leftOffset leftContainerView = UIView(frame: leftFrame) leftContainerView.backgroundColor = UIColor.clear - leftContainerView.autoresizingMask = UIViewAutoresizing.flexibleHeight + leftContainerView.autoresizingMask = UIView.AutoresizingMask.flexibleHeight view.insertSubview(leftContainerView, at: 2) addLeftGestures() } @@ -155,7 +155,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { rightFrame.size.height = rightFrame.size.height - rightOffset rightContainerView = UIView(frame: rightFrame) rightContainerView.backgroundColor = UIColor.clear - rightContainerView.autoresizingMask = UIViewAutoresizing.flexibleHeight + rightContainerView.autoresizingMask = UIView.AutoresizingMask.flexibleHeight view.insertSubview(rightContainerView, at: 3) addRightGestures() } @@ -356,7 +356,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { static var startPointOfPan: CGPoint = CGPoint.zero static var wasOpenAtStartOfPan: Bool = false static var wasHiddenAtStartOfPan: Bool = false - static var lastState : UIGestureRecognizerState = .ended + static var lastState : UIGestureRecognizer.State = .ended } @objc func handleLeftPanGesture(_ panGesture: UIPanGestureRecognizer) { @@ -436,7 +436,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { static var startPointOfPan: CGPoint = CGPoint.zero static var wasOpenAtStartOfPan: Bool = false static var wasHiddenAtStartOfPan: Bool = false - static var lastState : UIGestureRecognizerState = .ended + static var lastState : UIGestureRecognizer.State = .ended } @objc func handleRightPanGesture(_ panGesture: UIPanGestureRecognizer) { @@ -900,7 +900,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { if SlideMenuOptions.hideStatusBar { DispatchQueue.main.async(execute: { if let window = UIApplication.shared.keyWindow { - window.windowLevel = UIWindowLevelStatusBar + 1 + window.windowLevel = UIWindow.Level.statusBar + 1 } }) } @@ -910,7 +910,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { if SlideMenuOptions.hideStatusBar { DispatchQueue.main.async(execute: { if let window = UIApplication.shared.keyWindow { - window.windowLevel = UIWindowLevelNormal + window.windowLevel = UIWindow.Level.normal } }) } @@ -920,10 +920,10 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { if let viewController = targetViewController { viewController.view.frame = targetView.bounds - if (!childViewControllers.contains(viewController)) { - addChildViewController(viewController) + if (!children.contains(viewController)) { + addChild(viewController) targetView.addSubview(viewController.view) - viewController.didMove(toParentViewController: self) + viewController.didMove(toParent: self) } } } @@ -932,9 +932,9 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate { fileprivate func removeViewController(_ viewController: UIViewController?) { if let _viewController = viewController { _viewController.view.layer.removeAllAnimations() - _viewController.willMove(toParentViewController: nil) + _viewController.willMove(toParent: nil) _viewController.view.removeFromSuperview() - _viewController.removeFromParentViewController() + _viewController.removeFromParent() } } @@ -1042,12 +1042,12 @@ extension UIViewController { } public func addLeftBarButtonWithImage(_ buttonImage: UIImage) { - let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.toggleLeft)) + let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.toggleLeft)) navigationItem.leftBarButtonItem = leftButton } public func addRightBarButtonWithImage(_ buttonImage: UIImage) { - let rightButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.toggleRight)) + let rightButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.toggleRight)) navigationItem.rightBarButtonItem = rightButton }