From 15fef4ea0cd4ce768799e043993e0bfe76e1ecb7 Mon Sep 17 00:00:00 2001 From: Suric Date: Fri, 28 Sep 2018 10:23:29 +0800 Subject: [PATCH] update Swift to 4.2 --- DropdownMenu.xcodeproj/project.pbxproj | 22 +++++++------- DropdownMenu/DropUpMenu.swift | 2 +- DropdownMenu/DropdownMenu.swift | 10 +++---- .../project.pbxproj | 30 +++++++++---------- .../DropdownMenuDemoTests.swift | 3 -- 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/DropdownMenu.xcodeproj/project.pbxproj b/DropdownMenu.xcodeproj/project.pbxproj index 862a35b..dff4ff8 100644 --- a/DropdownMenu.xcodeproj/project.pbxproj +++ b/DropdownMenu.xcodeproj/project.pbxproj @@ -161,7 +161,7 @@ ACE6DB6B1CF74183005C6667 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = 7NLBE99QC4; - LastSwiftMigration = 0800; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; ACE6DB751CF74183005C6667 = { @@ -285,12 +285,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -339,11 +339,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -363,13 +363,13 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = DropdownMenu/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenu; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -385,12 +385,12 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = DropdownMenu/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenu; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -403,7 +403,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -416,7 +416,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/DropdownMenu/DropUpMenu.swift b/DropdownMenu/DropUpMenu.swift index aaa9aa8..1ab9c30 100644 --- a/DropdownMenu/DropUpMenu.swift +++ b/DropdownMenu/DropUpMenu.swift @@ -179,7 +179,7 @@ open class DropUpMenu: UIView { backgroundColor = backgroudBeginColor self.tableView.frame.origin.y = screenRect.height - bottomOffsetY - UIView.animate(withDuration: animateDuration, delay: 0, options: UIViewAnimationOptions(rawValue: 7<<16), animations: { + UIView.animate(withDuration: animateDuration, delay: 0, options: UIView.AnimationOptions(rawValue: 7<<16), animations: { self.backgroundColor = self.backgroudEndColor self.tableView.frame.origin.y = screenRect.height - self.bottomOffsetY - self.tableViewHeight }, completion: nil) diff --git a/DropdownMenu/DropdownMenu.swift b/DropdownMenu/DropdownMenu.swift index 03502f9..3950afd 100644 --- a/DropdownMenu/DropdownMenu.swift +++ b/DropdownMenu/DropdownMenu.swift @@ -70,7 +70,7 @@ open class DropdownMenu: UIView { tableView.backgroundColor = tableViewBackgroundColor } } - open var separatorStyle: UITableViewCellSeparatorStyle = .singleLine { + open var separatorStyle: UITableViewCell.SeparatorStyle = .singleLine { didSet { tableView.separatorStyle = separatorStyle } @@ -106,7 +106,7 @@ open class DropdownMenu: UIView { setupGestureView() initTableView() - NotificationCenter.default.addObserver(self, selector: #selector(self.updateForOrientationChange(_:)), name: NSNotification.Name.UIApplicationWillChangeStatusBarOrientation, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.updateForOrientationChange(_:)), name: UIApplication.willChangeStatusBarOrientationNotification, object: nil) } public init(navigationController: UINavigationController, sections: [DropdownSection], selectedIndexPath: IndexPath = IndexPath(row: 0, section: 0), dispalySectionHeader: Bool = true, sectionHeaderStyle: SectionHeaderStyle = SectionHeaderStyle()) { @@ -121,7 +121,7 @@ open class DropdownMenu: UIView { setupGestureView() initTableView() - NotificationCenter.default.addObserver(self, selector: #selector(self.updateForOrientationChange(_:)), name: NSNotification.Name.UIApplicationWillChangeStatusBarOrientation, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.updateForOrientationChange(_:)), name: UIApplication.willChangeStatusBarOrientationNotification, object: nil) } deinit { @@ -130,7 +130,7 @@ open class DropdownMenu: UIView { @objc func updateForOrientationChange(_ nofication: Notification) { print("UIApplicationWillChangeStatusBarOrientation") - if let oriention = (nofication as NSNotification).userInfo?[UIApplicationStatusBarOrientationUserInfoKey] as? Int { + if let oriention = (nofication as NSNotification).userInfo?[UIApplication.statusBarOrientationUserInfoKey] as? Int { var topOffset: CGFloat switch oriention { case UIInterfaceOrientation.landscapeLeft.rawValue, UIInterfaceOrientation.landscapeRight.rawValue: @@ -272,7 +272,7 @@ open class DropdownMenu: UIView { backgroundColor = backgroudBeginColor self.tableView.frame.origin.y = -self.tableViewHeight - UIView.animate(withDuration: animateDuration, delay: 0, options: UIViewAnimationOptions(rawValue: 7<<16), animations: { + UIView.animate(withDuration: animateDuration, delay: 0, options: UIView.AnimationOptions(rawValue: 7<<16), animations: { self.backgroundColor = self.backgroudEndColor self.tableView.frame.origin.y = 0 }, completion: nil) diff --git a/DropdownMenuDemo/DropdownMenuDemo.xcodeproj/project.pbxproj b/DropdownMenuDemo/DropdownMenuDemo.xcodeproj/project.pbxproj index 052459a..ecb07d9 100644 --- a/DropdownMenuDemo/DropdownMenuDemo.xcodeproj/project.pbxproj +++ b/DropdownMenuDemo/DropdownMenuDemo.xcodeproj/project.pbxproj @@ -224,18 +224,18 @@ ACE6DB8E1CF741F6005C6667 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = ZDUX4TJC7F; - LastSwiftMigration = 0800; + LastSwiftMigration = 1000; }; ACE6DBA21CF741F6005C6667 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = 7NLBE99QC4; - LastSwiftMigration = 0800; + LastSwiftMigration = 1000; TestTargetID = ACE6DB8E1CF741F6005C6667; }; ACE6DBAD1CF741F6005C6667 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = 7NLBE99QC4; - LastSwiftMigration = 0800; + LastSwiftMigration = 1000; TestTargetID = ACE6DB8E1CF741F6005C6667; }; }; @@ -395,12 +395,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -446,11 +446,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -462,11 +462,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ZDUX4TJC7F; INFOPLIST_FILE = DropdownMenuDemo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenu2; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -476,11 +476,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ZDUX4TJC7F; INFOPLIST_FILE = DropdownMenuDemo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenu2; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -493,7 +493,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuDemoTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DropdownMenuDemo.app/DropdownMenuDemo"; }; name = Debug; @@ -507,7 +507,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuDemoTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DropdownMenuDemo.app/DropdownMenuDemo"; }; name = Release; @@ -520,7 +520,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuDemoUITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = DropdownMenuDemo; }; name = Debug; @@ -533,7 +533,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuDemoUITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = DropdownMenuDemo; }; name = Release; diff --git a/DropdownMenuDemo/DropdownMenuDemoTests/DropdownMenuDemoTests.swift b/DropdownMenuDemo/DropdownMenuDemoTests/DropdownMenuDemoTests.swift index 8b1e1cf..07d6f5f 100644 --- a/DropdownMenuDemo/DropdownMenuDemoTests/DropdownMenuDemoTests.swift +++ b/DropdownMenuDemo/DropdownMenuDemoTests/DropdownMenuDemoTests.swift @@ -28,9 +28,6 @@ class DropdownMenuDemoTests: XCTestCase { func testPerformanceExample() { // This is an example of a performance test case. - self.measureBlock { - // Put the code you want to measure the time of here. - } } }