diff --git a/.travis.yml b/.travis.yml index 8af7aab5..905a78be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode10.1 +osx_image: xcode10.2 cache: - bundler - cocoapods diff --git a/Example-iOS/ViewControllers/ExampleViewController.swift b/Example-iOS/ViewControllers/ExampleViewController.swift index 4bb80f92..09c4d3f2 100644 --- a/Example-iOS/ViewControllers/ExampleViewController.swift +++ b/Example-iOS/ViewControllers/ExampleViewController.swift @@ -122,7 +122,7 @@ internal final class ExampleViewController: QuickTableViewController { private func showDebuggingText(_ text: String) { print(text) debugging.rows = [NavigationRow(text: text, detailText: .none)] - if let section = tableContents.index(where: { $0 === debugging }) { + if let section = tableContents.firstIndex(where: { $0 === debugging }) { tableView.reloadSections([section], with: .none) } } diff --git a/QuickTableViewController.xcodeproj/project.pbxproj b/QuickTableViewController.xcodeproj/project.pbxproj index 30d3433a..80dd29bc 100644 --- a/QuickTableViewController.xcodeproj/project.pbxproj +++ b/QuickTableViewController.xcodeproj/project.pbxproj @@ -755,52 +755,54 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1000; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = bcylin; TargetAttributes = { 136DD2FC216A367B00F554F0 = { CreatedOnToolsVersion = 10.0; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; TestTargetID = B54A24522088D44A00EEBA26; }; B51F21A11F417037009BC2C9 = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; B51F21BF1F41E600009BC2C9 = { CreatedOnToolsVersion = 8.3.3; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; TestTargetID = B51F21A11F417037009BC2C9; }; B5334F121B8CC5BD00C64A6D = { CreatedOnToolsVersion = 6.4; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; }; B5334F1D1B8CC5BD00C64A6D = { CreatedOnToolsVersion = 6.4; - LastSwiftMigration = 0930; + LastSwiftMigration = 1020; }; B54A24252088816D00EEBA26 = { CreatedOnToolsVersion = 9.3; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; B54A242D2088816E00EEBA26 = { CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; B54A24522088D44A00EEBA26 = { CreatedOnToolsVersion = 9.3; - LastSwiftMigration = 1000; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = B5334F0D1B8CC5BD00C64A6D /* Build configuration list for PBXProject "QuickTableViewController" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -1241,7 +1243,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TEST_TARGET_NAME = "Example-tvOS"; TVOS_DEPLOYMENT_TARGET = 12.0; @@ -1268,7 +1270,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TEST_TARGET_NAME = "Example-tvOS"; TVOS_DEPLOYMENT_TARGET = 12.0; @@ -1292,6 +1294,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1311,6 +1314,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1333,6 +1337,7 @@ PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; TEST_TARGET_NAME = "Example-iOS"; }; name = Debug; @@ -1355,6 +1360,7 @@ PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TEST_TARGET_NAME = "Example-iOS"; }; name = Release; @@ -1363,6 +1369,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_CODE_COVERAGE = YES; @@ -1427,6 +1434,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_CODE_COVERAGE = YES; @@ -1495,6 +1503,7 @@ PRODUCT_NAME = QuickTableViewController; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1514,6 +1523,7 @@ PRODUCT_NAME = QuickTableViewController; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1534,7 +1544,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = io.github.bcylin.QuickTableViewControllerTests; PRODUCT_NAME = QuickTableViewControllerTests; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1552,7 +1562,7 @@ PRODUCT_BUNDLE_IDENTIFIER = io.github.bcylin.QuickTableViewControllerTests; PRODUCT_NAME = QuickTableViewControllerTests; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1581,6 +1591,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -1610,6 +1621,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -1635,6 +1647,7 @@ PRODUCT_NAME = QuickTableViewControllerTests; SDKROOT = appletvos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 11.3; }; @@ -1659,6 +1672,7 @@ PRODUCT_NAME = QuickTableViewControllerTests; SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 11.3; }; @@ -1685,6 +1699,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -1710,6 +1725,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; diff --git a/QuickTableViewController.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme b/QuickTableViewController.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme index d39fbe59..50c99bcd 100644 --- a/QuickTableViewController.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme +++ b/QuickTableViewController.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme @@ -1,6 +1,6 @@ Void)? = nil, action: ((Row) -> Void)? diff --git a/Source/Model/RadioSection.swift b/Source/Model/RadioSection.swift index f8a76de5..cc04d10a 100644 --- a/Source/Model/RadioSection.swift +++ b/Source/Model/RadioSection.swift @@ -69,7 +69,7 @@ open class RadioSection: Section { /// Returns the selected index, or nil when nothing is selected. open var indexOfSelectedOption: Int? { - return options.index { $0.isSelected } + return options.firstIndex { $0.isSelected } } /// Returns the selected option row, or nil when nothing is selected. @@ -97,7 +97,7 @@ open class RadioSection: Section { if option.isSelected { // Deselect the selected option. - return options.index(where: { $0 === option }).map { [$0] } ?? [] + return options.firstIndex(where: { $0 === option }).map { [$0] } ?? [] } var toggledIndexes: IndexSet = [] diff --git a/Source/Model/Subtitle.swift b/Source/Model/Subtitle.swift index 1021bcf2..e885eff3 100644 --- a/Source/Model/Subtitle.swift +++ b/Source/Model/Subtitle.swift @@ -64,7 +64,7 @@ public enum Subtitle: Equatable { internal extension DetailText { @available(*, deprecated, message: "The conversion between DetailText and Subtitle.") - internal var subtitle: Subtitle { + var subtitle: Subtitle { switch self { case .none: return .none case let .subtitle(text): return .belowTitle(text) diff --git a/Source/Protocol/Reusable.swift b/Source/Protocol/Reusable.swift index 1c3a98bd..6c77f27b 100644 --- a/Source/Protocol/Reusable.swift +++ b/Source/Protocol/Reusable.swift @@ -36,7 +36,7 @@ internal protocol Reusable { internal extension Reusable { - internal static var reuseIdentifier: String { + static var reuseIdentifier: String { let type = String(describing: self) return type.matches(of: String.typeDescriptionPattern).last ?? type } @@ -46,12 +46,12 @@ internal extension Reusable { internal extension String { - internal static var typeDescriptionPattern: String { + static var typeDescriptionPattern: String { // For the types in the format of "(CustomCell in _B5334F301B8CC6AA00C64A6D)" return "^\\(([\\w\\d]+)\\sin\\s_[0-9A-F]+\\)$" } - internal func matches(of pattern: String) -> [String] { + func matches(of pattern: String) -> [String] { let regex = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) #if swift(>=3.2) let fullText = NSRange(location: 0, length: count) diff --git a/Source/Rows/NavigationRow.swift b/Source/Rows/NavigationRow.swift index 39ab847d..ebcd3f7a 100644 --- a/Source/Rows/NavigationRow.swift +++ b/Source/Rows/NavigationRow.swift @@ -147,10 +147,11 @@ private extension UITableViewCell.CellStyle { var stringValue: String { switch self { - case .default: return ".default" - case .subtitle: return ".subtitle" - case .value1: return ".value1" - case .value2: return ".value2" + case .default: return ".default" + case .subtitle: return ".subtitle" + case .value1: return ".value1" + case .value2: return ".value2" + @unknown default: return ".default" } }