diff --git a/SnapKit.xcodeproj/project.pbxproj b/SnapKit.xcodeproj/project.pbxproj index 7221d08..91d18f6 100644 --- a/SnapKit.xcodeproj/project.pbxproj +++ b/SnapKit.xcodeproj/project.pbxproj @@ -302,16 +302,16 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0820; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "SnapKit Team"; TargetAttributes = { EEBCC9D719CC627D0083B827 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; EEBCC9E119CC627D0083B827 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; ProvisioningStyle = Automatic; }; }; @@ -412,14 +412,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -463,14 +469,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -513,6 +525,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -532,6 +545,7 @@ PRODUCT_NAME = SnapKit; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; @@ -545,7 +559,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @loader_path/../Frameworks @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -559,7 +573,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme b/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme index 5760875..48ec452 100644 --- a/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme +++ b/SnapKit.xcodeproj/xcshareddata/xcschemes/SnapKit.xcscheme @@ -1,6 +1,6 @@ String? { - return objc_getAssociatedObject(self.target, &labelKey) as? String + return objc_getAssociatedObject(self.target as Any, &labelKey) as? String } } diff --git a/Source/ConstraintViewDSL.swift b/Source/ConstraintViewDSL.swift index 8b38d32..4485da4 100644 --- a/Source/ConstraintViewDSL.swift +++ b/Source/ConstraintViewDSL.swift @@ -53,37 +53,37 @@ public struct ConstraintViewDSL: ConstraintAttributesDSL { public var contentHuggingHorizontalPriority: Float { get { - return self.view.contentHuggingPriority(for: .horizontal) + return self.view.contentHuggingPriority(for: .horizontal).rawValue } set { - self.view.setContentHuggingPriority(newValue, for: .horizontal) + self.view.setContentHuggingPriority(UILayoutPriority(rawValue: newValue), for: .horizontal) } } public var contentHuggingVerticalPriority: Float { get { - return self.view.contentHuggingPriority(for: .vertical) + return self.view.contentHuggingPriority(for: .vertical).rawValue } set { - self.view.setContentHuggingPriority(newValue, for: .vertical) + self.view.setContentHuggingPriority(UILayoutPriority(rawValue: newValue), for: .vertical) } } public var contentCompressionResistanceHorizontalPriority: Float { get { - return self.view.contentCompressionResistancePriority(for: .horizontal) + return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue } set { - self.view.setContentCompressionResistancePriority(newValue, for: .horizontal) + self.view.setContentCompressionResistancePriority(UILayoutPriority(rawValue: newValue), for: .horizontal) } } public var contentCompressionResistanceVerticalPriority: Float { get { - return self.view.contentCompressionResistancePriority(for: .vertical) + return self.view.contentCompressionResistancePriority(for: .vertical).rawValue } set { - self.view.setContentCompressionResistancePriority(newValue, for: .vertical) + self.view.setContentCompressionResistancePriority(UILayoutPriority(rawValue: newValue), for: .vertical) } } diff --git a/Source/Debugging.swift b/Source/Debugging.swift index fdc505d..d57dde5 100644 --- a/Source/Debugging.swift +++ b/Source/Debugging.swift @@ -66,7 +66,7 @@ public extension LayoutConstraint { } } - if self.priority != 1000.0 { + if self.priority.rawValue != 1000.0 { description += " ^\(self.priority)" } diff --git a/Tests/Tests.swift b/Tests/Tests.swift index e232fcc..34f74ac 100644 --- a/Tests/Tests.swift +++ b/Tests/Tests.swift @@ -542,7 +542,7 @@ class SnapKitTests: XCTestCase { func testPriorityStride() { let highPriority: ConstraintPriority = .high - let higherPriority: ConstraintPriority = .high + 1 + let higherPriority: ConstraintPriority = ConstraintPriority.high.advanced(by: 1) XCTAssertEqual(higherPriority.value, highPriority.value + 1) } }