diff --git a/.swift-version b/.swift-version index 7d5c902e..bf77d549 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.1 +4.2 diff --git a/LayoutKit.podspec b/LayoutKit.podspec index e1251821..f1467b48 100644 --- a/LayoutKit.podspec +++ b/LayoutKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'LayoutKit' - spec.version = '10.1.0' + spec.version = '10.1.1' spec.license = { :type => 'Apache License, Version 2.0' } spec.homepage = 'http://layoutkit.org' spec.authors = 'LinkedIn' @@ -42,4 +42,3 @@ Pod::Spec.new do |spec| ] end - diff --git a/LayoutKit.xcodeproj/project.pbxproj b/LayoutKit.xcodeproj/project.pbxproj index a95b5e24..959b85fd 100644 --- a/LayoutKit.xcodeproj/project.pbxproj +++ b/LayoutKit.xcodeproj/project.pbxproj @@ -530,7 +530,6 @@ 7EEA2AC7201D18F20077A088 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 7EEA2ACC201D1FE90077A088 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 7EECD0612053916C003DC4B1 /* LayoutKitObjC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LayoutKitObjC.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 7EECD0622053916C003DC4B1 /* LayoutKit-iOS copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "LayoutKit-iOS copy-Info.plist"; path = "/Users/staguer/ws/lk0/LayoutKit-iOS copy-Info.plist"; sourceTree = ""; }; A189721021B8BB3B00DDA616 /* EmbeddedLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmbeddedLayoutTests.swift; sourceTree = ""; }; AD2C36421EA5AF9500550A03 /* ReloadableViewLayoutAdapterCollectionViewOverrideTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReloadableViewLayoutAdapterCollectionViewOverrideTests.swift; sourceTree = ""; }; ADE5FCBF1EA5B5C8006A3DC2 /* ReloadableViewLayoutAdapterTableViewOverrideTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReloadableViewLayoutAdapterTableViewOverrideTests.swift; sourceTree = ""; }; @@ -672,7 +671,6 @@ 7EEA2AB7201D18F20077A088 /* LayoutKitObjCSampleApp */, 0BCB75601D8720110065E02A /* Products */, 7EEA2ACE201D24530077A088 /* Frameworks */, - 7EECD0622053916C003DC4B1 /* LayoutKit-iOS copy-Info.plist */, ); sourceTree = ""; }; @@ -1156,52 +1154,60 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; TargetAttributes = { 0B2D09AF1D8735E1007E487C = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 0BCB755E1D8720110065E02A = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 0BCB75671D8720110065E02A = { CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 0BCB757B1D8721370065E02A = { CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 0BCB75831D8721370065E02A = { CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 0BCB75971D8722370065E02A = { CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 0BCB759F1D8722370065E02A = { CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 0BCB75B51D8723B30065E02A = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 7EEA2AB5201D18F20077A088 = { CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; }; + 7EECD00E2053916C003DC4B1 = { + LastSwiftMigration = 1020; + }; }; }; buildConfigurationList = 0BCB75571D871FC40065E02A /* Build configuration list for PBXProject "LayoutKit" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -1730,6 +1736,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1777,6 +1784,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -1785,6 +1793,7 @@ 0BCB75581D871FC40065E02A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -1812,13 +1821,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; - SWIFT_VERSION = 4.1; + SWIFT_VERSION = 4.2; }; name = Debug; }; 0BCB75591D871FC40065E02A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -1845,7 +1855,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_VERSION = 4.1; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -1908,6 +1918,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1965,6 +1976,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -2023,6 +2035,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -2069,6 +2082,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -2130,6 +2144,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; @@ -2186,6 +2201,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; @@ -2243,6 +2259,7 @@ SDKROOT = appletvos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.2; }; name = Debug; @@ -2288,6 +2305,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TVOS_DEPLOYMENT_TARGET = 9.2; VALIDATE_PRODUCT = YES; }; @@ -2353,6 +2371,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2410,6 +2429,7 @@ SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2467,6 +2487,7 @@ SDKROOT = macosx; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -2514,6 +2535,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -2575,6 +2597,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2631,6 +2654,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -2773,6 +2797,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2830,6 +2855,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/LayoutKit.xcodeproj/xcshareddata/xcschemes/ExampleLayouts-iOS.xcscheme b/LayoutKit.xcodeproj/xcshareddata/xcschemes/ExampleLayouts-iOS.xcscheme index 53f5d6e0..62d0d4d4 100644 --- a/LayoutKit.xcodeproj/xcshareddata/xcschemes/ExampleLayouts-iOS.xcscheme +++ b/LayoutKit.xcodeproj/xcshareddata/xcschemes/ExampleLayouts-iOS.xcscheme @@ -1,6 +1,6 @@ 'Apache License, Version 2.0' } spec.homepage = 'http://layoutkit.org' spec.authors = 'LinkedIn' @@ -45,8 +45,7 @@ Pod::Spec.new do |spec| # Excluded due to "'systemFontSize' is unavailable" 'Sources/ObjCSupport/Builders/LOKLabelLayoutBuilder.*', - 'Sources/ObjCSupport/LOKLabelLayout.swift' + 'Sources/ObjCSupport/LOKLabelLayout.swift' ] end - diff --git a/LayoutKitSampleApp/AppDelegate.swift b/LayoutKitSampleApp/AppDelegate.swift index 46cebad2..393674a2 100644 --- a/LayoutKitSampleApp/AppDelegate.swift +++ b/LayoutKitSampleApp/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) window?.rootViewController = UINavigationController(rootViewController: MenuViewController()) window?.makeKeyAndVisible() diff --git a/LayoutKitSampleApp/Benchmarks/TableViewController.swift b/LayoutKitSampleApp/Benchmarks/TableViewController.swift index d486d0df..3ca041f9 100644 --- a/LayoutKitSampleApp/Benchmarks/TableViewController.swift +++ b/LayoutKitSampleApp/Benchmarks/TableViewController.swift @@ -28,7 +28,7 @@ class TableViewController: UITableViewController where init(data: [CellType.DataType]) { self.data = data - super.init(style: UITableViewStyle.grouped) + super.init(style: UITableView.Style.grouped) } required init?(coder aDecoder: NSCoder) { @@ -52,7 +52,7 @@ class TableViewController: UITableViewController where } override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return UITableViewAutomaticDimension + return UITableView.automaticDimension } } diff --git a/LayoutKitTests/LabelLayoutTests.swift b/LayoutKitTests/LabelLayoutTests.swift index f7eed7c2..f1c20321 100644 --- a/LayoutKitTests/LabelLayoutTests.swift +++ b/LayoutKitTests/LabelLayoutTests.swift @@ -52,7 +52,7 @@ class LabelLayoutTests: XCTestCase { } func testAttributedLabel() { - let attributedText = NSAttributedString(string: "Hi", attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 42)]) + let attributedText = NSAttributedString(string: "Hi", attributes: [NSAttributedString.Key.font: UIFont.helvetica(size: 42)]) let font = UIFont.helvetica(size: 99) let arrangement = LabelLayout(attributedText: attributedText, font: font).arrangement() @@ -122,7 +122,7 @@ class LabelLayoutTests: XCTestCase { func testAttributedTextCustomFont() { #if !os(tvOS) // tvOS doesn't currently support custom fonts let font = UIFont(name: "Papyrus", size: 20)! - let attributes = [NSAttributedStringKey.font: font] + let attributes = [NSAttributedString.Key.font: font] let text = NSAttributedString(string: "Hello! 😄😄😄", attributes: attributes) let arrangement = LabelLayout(attributedText: text).arrangement() @@ -136,7 +136,7 @@ class LabelLayoutTests: XCTestCase { #if !os(tvOS) // tvOS doesn't currently support custom fonts let font = UIFont(name: "Papyrus", size: 20)! let text = NSMutableAttributedString(string: "Hello world! 😄😄😄") - text.addAttribute(NSAttributedStringKey.font, value: font, range: NSMakeRange(6, 6)) + text.addAttribute(NSAttributedString.Key.font, value: font, range: NSMakeRange(6, 6)) let arrangement = LabelLayout(attributedText: text).arrangement() let label = UILabel(attributedText: text) diff --git a/LayoutKitTests/ReloadableViewLayoutAdapterCollectionViewTests.swift b/LayoutKitTests/ReloadableViewLayoutAdapterCollectionViewTests.swift index dfcd83d7..3e57aa3b 100644 --- a/LayoutKitTests/ReloadableViewLayoutAdapterCollectionViewTests.swift +++ b/LayoutKitTests/ReloadableViewLayoutAdapterCollectionViewTests.swift @@ -110,11 +110,11 @@ private class TestCollectionView: LayoutAdapterCollectionView, TestableReloadabl } fileprivate func verifyHeader(_ section: Int, text: String?, frame: CGRect?, file: StaticString, line: UInt) { - verifySupplementaryView(UICollectionElementKindSectionHeader, section: section, text: text, frame: frame, file: file, line: line) + verifySupplementaryView(UICollectionView.elementKindSectionHeader, section: section, text: text, frame: frame, file: file, line: line) } fileprivate func verifyFooter(_ section: Int, text: String?, frame: CGRect?, file: StaticString, line: UInt) { - verifySupplementaryView(UICollectionElementKindSectionFooter, section: section, text: text, frame: frame, file: file, line: line) + verifySupplementaryView(UICollectionView.elementKindSectionFooter, section: section, text: text, frame: frame, file: file, line: line) } private func verifySupplementaryView(_ kind: String, section: Int, text: String?, frame: CGRect?, file: StaticString, line: UInt) { diff --git a/LayoutKitTests/ReloadableViewLayoutAdapterTableViewTests.swift b/LayoutKitTests/ReloadableViewLayoutAdapterTableViewTests.swift index b081c605..c11013e7 100644 --- a/LayoutKitTests/ReloadableViewLayoutAdapterTableViewTests.swift +++ b/LayoutKitTests/ReloadableViewLayoutAdapterTableViewTests.swift @@ -68,17 +68,17 @@ private class TestTableView: LayoutAdapterTableView, TestableReloadableView { reloadDataCount += 1 } - fileprivate override func insertRows(at indexPaths: [IndexPath], with animation: UITableViewRowAnimation) { + fileprivate override func insertRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) { super.insertRows(at: indexPaths, with: animation) batchUpdates.insertItems.append(contentsOf: indexPaths) } - fileprivate override func deleteRows(at indexPaths: [IndexPath], with animation: UITableViewRowAnimation) { + fileprivate override func deleteRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) { super.deleteRows(at: indexPaths, with: animation) batchUpdates.deleteItems.append(contentsOf: indexPaths) } - fileprivate override func reloadRows(at indexPaths: [IndexPath], with animation: UITableViewRowAnimation) { + fileprivate override func reloadRows(at indexPaths: [IndexPath], with animation: UITableView.RowAnimation) { super.reloadRows(at: indexPaths, with: animation) batchUpdates.reloadItems.append(contentsOf: indexPaths) } @@ -88,17 +88,17 @@ private class TestTableView: LayoutAdapterTableView, TestableReloadableView { batchUpdates.moveItems.append(ItemMove(from: indexPath, to: newIndexPath)) } - fileprivate override func insertSections(_ sections: IndexSet, with animation: UITableViewRowAnimation) { + fileprivate override func insertSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) { super.insertSections(sections, with: animation) batchUpdates.insertSections.formUnion(sections) } - fileprivate override func reloadSections(_ sections: IndexSet, with animation: UITableViewRowAnimation) { + fileprivate override func reloadSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) { super.reloadSections(sections, with: animation) batchUpdates.reloadSections.formUnion(sections) } - fileprivate override func deleteSections(_ sections: IndexSet, with animation: UITableViewRowAnimation) { + fileprivate override func deleteSections(_ sections: IndexSet, with animation: UITableView.RowAnimation) { super.deleteSections(sections, with: animation) batchUpdates.deleteSections.formUnion(sections) } diff --git a/LayoutKitTests/TextExtension.swift b/LayoutKitTests/TextExtension.swift index 699787f4..af6ce383 100644 --- a/LayoutKitTests/TextExtension.swift +++ b/LayoutKitTests/TextExtension.swift @@ -30,12 +30,12 @@ extension Text { .unattributed("Hello! 😄😄😄"), .attributed(NSAttributedString(string: "")), .attributed(NSAttributedString(string: " ")), - .attributed(NSAttributedString(string: "", attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 42)])), - .attributed(NSAttributedString(string: " ", attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 42)])), + .attributed(NSAttributedString(string: "", attributes: [NSAttributedString.Key.font: UIFont.helvetica(size: 42)])), + .attributed(NSAttributedString(string: " ", attributes: [NSAttributedString.Key.font: UIFont.helvetica(size: 42)])), .attributed(NSAttributedString(string: "Hi")), .attributed(NSAttributedString(string: "Hello world")), .attributed(NSAttributedString(string: "Hello! 😄😄😄")), - .attributed(NSAttributedString(string: "Hello! 😄😄😄", attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 42)])), + .attributed(NSAttributedString(string: "Hello! 😄😄😄", attributes: [NSAttributedString.Key.font: UIFont.helvetica(size: 42)])), ] let fontSizes = 0...20 diff --git a/LayoutKitTests/TextViewLayoutTests.swift b/LayoutKitTests/TextViewLayoutTests.swift index cf9db5a3..353767e9 100644 --- a/LayoutKitTests/TextViewLayoutTests.swift +++ b/LayoutKitTests/TextViewLayoutTests.swift @@ -67,10 +67,10 @@ class TextViewLayoutTests: XCTestCase { let textString = "Hello World\nHello World\nHello World\nHello World\nHello World" let attributedString1 = NSMutableAttributedString( string: textString, - attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 15)]) + attributes: [NSAttributedString.Key.font: UIFont.helvetica(size: 15)]) let attributedString2 = NSMutableAttributedString( string: textString, - attributes: [NSAttributedStringKey.font: UIFont.helvetica(size: 12)]) + attributes: [NSAttributedString.Key.font: UIFont.helvetica(size: 12)]) attributedString1.append(attributedString2) let attributedText = Text.attributed(attributedString1) diff --git a/Sources/ConfigurableLayout.swift b/Sources/ConfigurableLayout.swift index b205ea61..b1e2af0b 100644 --- a/Sources/ConfigurableLayout.swift +++ b/Sources/ConfigurableLayout.swift @@ -42,7 +42,7 @@ public protocol ConfigurableLayout: Layout { // Implement `configure(baseViewType:)` from `Layout`. public extension ConfigurableLayout { - public func configure(baseTypeView: View) { + func configure(baseTypeView: View) { guard let view = baseTypeView as? ConfigurableView else { assertionFailure("Expected baseTypeView \(baseTypeView) to be of type \(ConfigurableView.self) but it was of type \(type(of: baseTypeView))") return diff --git a/Sources/Info.plist b/Sources/Info.plist index 6f97bda2..8fb0c957 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 10.1.0 + 10.1.1 CFBundleSignature ???? CFBundleVersion diff --git a/Sources/Internal/NSAttributedStringExtension.swift b/Sources/Internal/NSAttributedStringExtension.swift index 51a7b0f0..673f789e 100644 --- a/Sources/Internal/NSAttributedStringExtension.swift +++ b/Sources/Internal/NSAttributedStringExtension.swift @@ -12,7 +12,7 @@ extension NSAttributedString { /// Returns a new NSAttributedString with a given font and the same attributes. func with(font: UIFont) -> NSAttributedString { - let fontAttribute = [NSAttributedStringKey.font: font] + let fontAttribute = [NSAttributedString.Key.font: font] let attributedTextWithFont = NSMutableAttributedString(string: string, attributes: fontAttribute) let fullRange = NSMakeRange(0, (string as NSString).length) attributedTextWithFont.beginEditing() diff --git a/Sources/Layouts/ButtonLayout.swift b/Sources/Layouts/ButtonLayout.swift index f1189548..35e6dbf1 100644 --- a/Sources/Layouts/ButtonLayout.swift +++ b/Sources/Layouts/ButtonLayout.swift @@ -292,7 +292,7 @@ public enum ButtonLayoutType { case infoDark case contactAdd - public var buttonType: UIButtonType { + public var buttonType: UIButton.ButtonType { switch (self) { case .custom: return .custom diff --git a/Sources/Layouts/TextViewLayout.swift b/Sources/Layouts/TextViewLayout.swift index b71c8ac8..5f43adf7 100644 --- a/Sources/Layouts/TextViewLayout.swift +++ b/Sources/Layouts/TextViewLayout.swift @@ -233,7 +233,7 @@ private extension Text { case .attributed(_): let text = Text.attributed(NSAttributedString( string: spaceString, - attributes: [NSAttributedStringKey.font: font])) + attributes: [NSAttributedString.Key.font: font])) size = text.textSize(within: maxSize, font: font) case .unattributed(_): diff --git a/Sources/Text.swift b/Sources/Text.swift index 0166104f..e50e1d33 100644 --- a/Sources/Text.swift +++ b/Sources/Text.swift @@ -39,7 +39,7 @@ public enum Text { if text.isEmpty { return .zero } - size = text.boundingRect(with: maxSize, options: options, attributes: [NSAttributedStringKey.font: font], context: nil).size + size = text.boundingRect(with: maxSize, options: options, attributes: [NSAttributedString.Key.font: font], context: nil).size } // boundingRect(with:options:attributes:) returns size to a precision of hundredths of a point, // but UILabel only returns sizes with a point precision of 1/screenDensity. diff --git a/Sources/UIKitSupport.swift b/Sources/UIKitSupport.swift index a0d44664..0897c36e 100644 --- a/Sources/UIKitSupport.swift +++ b/Sources/UIKitSupport.swift @@ -39,6 +39,8 @@ extension UIView { return .leftToRight case .rightToLeft: return .rightToLeft + @unknown default: + return .leftToRight } } else { #if LAYOUTKIT_EXTENSION_DEFAULT_RIGHT_TO_LEFT diff --git a/Sources/Views/ReloadableView.swift b/Sources/Views/ReloadableView.swift index 4fb7f55c..ddb7b257 100644 --- a/Sources/Views/ReloadableView.swift +++ b/Sources/Views/ReloadableView.swift @@ -60,8 +60,8 @@ extension UICollectionView: ReloadableView { @objc open func registerViews(withReuseIdentifier reuseIdentifier: String) { register(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier) - register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: reuseIdentifier) - register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: reuseIdentifier) + register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: reuseIdentifier) + register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: reuseIdentifier) } @objc diff --git a/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift b/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift index 985cd0fa..87f2bcab 100644 --- a/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift +++ b/Sources/Views/ReloadableViewLayoutAdapter+UICollectionView.swift @@ -55,9 +55,9 @@ extension ReloadableViewLayoutAdapter: UICollectionViewDataSource { let view = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: reuseIdentifier, for: indexPath) let arrangement: LayoutArrangement? switch kind { - case UICollectionElementKindSectionHeader: + case UICollectionView.elementKindSectionHeader: arrangement = currentArrangement[indexPath.section].header - case UICollectionElementKindSectionFooter: + case UICollectionView.elementKindSectionFooter: arrangement = currentArrangement[indexPath.section].footer default: arrangement = nil diff --git a/Sources/Views/StackView.swift b/Sources/Views/StackView.swift index 4fdffed9..94d4bfc4 100644 --- a/Sources/Views/StackView.swift +++ b/Sources/Views/StackView.swift @@ -154,7 +154,7 @@ private struct ViewLayout: ConfigurableLayout { return Flexibility(horizontal: horizontal, vertical: vertical) } - private func flexForAxis(_ axis: UILayoutConstraintAxis) -> Flexibility.Flex { + private func flexForAxis(_ axis: NSLayoutConstraint.Axis) -> Flexibility.Flex { switch view.contentHuggingPriority(for: .horizontal) { case UILayoutPriority.required: return nil diff --git a/build.sh b/build.sh index 33f3b85d..676c01ba 100755 --- a/build.sh +++ b/build.sh @@ -18,6 +18,7 @@ time xcodebuild clean test \ -destination 'platform=iOS Simulator,name=iPhone 6 Plus,OS=10.3.1' \ -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.3' \ -destination 'platform=iOS Simulator,name=iPhone 7 Plus,OS=11.3' \ + -SWIFT_VERSION=5.0 \ OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' \ | tee build.log \ | xcpretty && @@ -29,6 +30,7 @@ time xcodebuild clean test \ -scheme LayoutKit-macOS \ -sdk macosx10.13 \ -derivedDataPath $DERIVED_DATA \ + -SWIFT_VERSION=5.0 \ OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' \ | tee build.log \ | xcpretty && @@ -42,6 +44,7 @@ time xcodebuild clean test \ -sdk appletvsimulator11.3 \ -derivedDataPath $DERIVED_DATA \ -destination 'platform=tvOS Simulator,name=Apple TV 1080p,OS=11.0' \ + -SWIFT_VERSION=5.0 \ OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' \ | tee build.log \ | xcpretty && @@ -58,6 +61,7 @@ time xcodebuild clean build \ -destination 'platform=iOS Simulator,name=iPhone 6 Plus,OS=10.3.1' \ -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.3' \ -destination 'platform=iOS Simulator,name=iPhone 7 Plus,OS=11.3' \ + -SWIFT_VERSION=5.0 \ OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' \ | tee ../build.log \ | xcpretty && @@ -75,6 +79,7 @@ time xcodebuild clean build \ -sdk iphonesimulator11.3 \ -derivedDataPath $DERIVED_DATA \ -destination 'platform=iOS Simulator,name=iPhone 7,OS=11.3' \ + -SWIFT_VERSION=5.0 \ OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' \ | tee ../../../build.log \ | xcpretty && @@ -90,6 +95,7 @@ time xcodebuild clean build \ -scheme LayoutKit-macOS \ -sdk macosx10.13 \ -derivedDataPath $DERIVED_DATA \ + -SWIFT_VERSION=5.0 \ OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' \ | tee ../../../build.log \ | xcpretty && @@ -106,6 +112,7 @@ time xcodebuild clean build \ -sdk appletvsimulator11.3 \ -derivedDataPath $DERIVED_DATA \ -destination 'platform=tvOS Simulator,name=Apple TV 1080p,OS=11.0' \ + -SWIFT_VERSION=5.0 \ OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' \ | tee ../../../build.log \ | xcpretty &&