mirror of https://github.com/SnapKit/SnapKit
Support swift 5.0 (#570)
* Update swift version 5.0 * Remove needless access control * Fix misused "Available" annotations * Support @unknown default * Support swift 5.0 in test code * Update podspec * Update travis CI * Code review by @freak4pc * Add constraint for Swift version * Fix build failed
This commit is contained in:
parent
2f5a5da245
commit
ca81e8ece0
|
@ -1,10 +1,10 @@
|
|||
language: objective-c
|
||||
osx_image: xcode9
|
||||
osx_image: xcode10.2
|
||||
|
||||
env:
|
||||
- ACTION=test PLATFORM=Mac DESTINATION='platform=OS X'
|
||||
- ACTION=test PLATFORM=Mac DESTINATION='platform=macOS'
|
||||
- ACTION=test PLATFORM=iOS DESTINATION='platform=iOS Simulator,name=iPhone 6S'
|
||||
- ACTION=test PLATFORM=tvOS DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p'
|
||||
- ACTION=test PLATFORM=tvOS DESTINATION='platform=tvOS Simulator,name=Apple TV 4K (at 1080p)'
|
||||
|
||||
script:
|
||||
- set -o pipefail && xcodebuild -scheme SnapKit -destination "$DESTINATION" $ACTION | xcpretty
|
||||
|
|
|
@ -14,5 +14,5 @@ Pod::Spec.new do |s|
|
|||
|
||||
s.source_files = 'Source/*.swift'
|
||||
|
||||
s.swift_version = '4.2'
|
||||
s.swift_version = '5.0'
|
||||
end
|
||||
|
|
|
@ -310,11 +310,11 @@
|
|||
TargetAttributes = {
|
||||
EEBCC9D719CC627D0083B827 = {
|
||||
CreatedOnToolsVersion = 6.0;
|
||||
LastSwiftMigration = 0900;
|
||||
LastSwiftMigration = 1020;
|
||||
};
|
||||
EEBCC9E119CC627D0083B827 = {
|
||||
CreatedOnToolsVersion = 6.0;
|
||||
LastSwiftMigration = 0900;
|
||||
LastSwiftMigration = 1020;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
|
@ -533,7 +533,7 @@
|
|||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -553,7 +553,7 @@
|
|||
PRODUCT_NAME = SnapKit;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
|
@ -567,7 +567,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 = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -581,7 +581,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
@ -189,12 +189,12 @@ public final class Constraint {
|
|||
|
||||
// MARK: Public
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use activate().")
|
||||
@available(*, deprecated, message:"Use activate().")
|
||||
public func install() {
|
||||
self.activate()
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use deactivate().")
|
||||
@available(*, deprecated, message:"Use deactivate().")
|
||||
public func uninstall() {
|
||||
self.deactivate()
|
||||
}
|
||||
|
@ -231,25 +231,25 @@ public final class Constraint {
|
|||
return self
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use update(offset: ConstraintOffsetTarget) instead.")
|
||||
@available(*, deprecated, message:"Use update(offset: ConstraintOffsetTarget) instead.")
|
||||
public func updateOffset(amount: ConstraintOffsetTarget) -> Void { self.update(offset: amount) }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use update(inset: ConstraintInsetTarget) instead.")
|
||||
@available(*, deprecated, message:"Use update(inset: ConstraintInsetTarget) instead.")
|
||||
public func updateInsets(amount: ConstraintInsetTarget) -> Void { self.update(inset: amount) }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
public func updatePriority(amount: ConstraintPriorityTarget) -> Void { self.update(priority: amount) }
|
||||
|
||||
@available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
public func updatePriorityRequired() -> Void {}
|
||||
|
||||
@available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
public func updatePriorityHigh() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
||||
|
||||
@available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
public func updatePriorityMedium() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
||||
|
||||
@available(*, obsoleted:3.0, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
@available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
|
||||
public func updatePriorityLow() -> Void { fatalError("Must be implemented by Concrete subclass.") }
|
||||
|
||||
// MARK: Internal
|
||||
|
|
|
@ -82,7 +82,11 @@ extension ConstraintConstantTarget {
|
|||
return value.y
|
||||
case .width, .height, .notAnAttribute:
|
||||
return 0.0
|
||||
}
|
||||
#if swift(>=5.0)
|
||||
@unknown default:
|
||||
return 0.0
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
switch layoutAttribute {
|
||||
case .left, .right, .leading, .trailing, .centerX:
|
||||
|
@ -91,7 +95,11 @@ extension ConstraintConstantTarget {
|
|||
return value.y
|
||||
case .width, .height, .notAnAttribute:
|
||||
return 0.0
|
||||
}
|
||||
#if swift(>=5.0)
|
||||
@unknown default:
|
||||
return 0.0
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -116,7 +124,11 @@ extension ConstraintConstantTarget {
|
|||
return -(value.top + value.bottom)
|
||||
case .notAnAttribute:
|
||||
return 0.0
|
||||
}
|
||||
#if swift(>=5.0)
|
||||
@unknown default:
|
||||
return 0.0
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
switch layoutAttribute {
|
||||
case .left, .centerX:
|
||||
|
@ -137,7 +149,11 @@ extension ConstraintConstantTarget {
|
|||
return -(value.top + value.bottom)
|
||||
case .notAnAttribute:
|
||||
return 0.0
|
||||
}
|
||||
#if swift(>=5.0)
|
||||
@unknown default:
|
||||
return 0.0
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ extension ConstraintAttributesDSL {
|
|||
|
||||
// MARK: Baselines
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use .lastBaseline instead")
|
||||
@available(*, deprecated, message:"Use .lastBaseline instead")
|
||||
public var baseline: ConstraintItem {
|
||||
return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
@available(iOS 9.0, OSX 10.11, *)
|
||||
public extension ConstraintLayoutGuide {
|
||||
|
||||
public var snp: ConstraintLayoutGuideDSL {
|
||||
var snp: ConstraintLayoutGuideDSL {
|
||||
return ConstraintLayoutGuideDSL(guide: self)
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ConstraintMaker {
|
|||
return self.makeExtendableWithAttributes(.centerY)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use lastBaseline instead")
|
||||
@available(*, deprecated, message:"Use lastBaseline instead")
|
||||
public var baseline: ConstraintMakerExtendable {
|
||||
return self.makeExtendableWithAttributes(.lastBaseline)
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class ConstraintMakerExtendable: ConstraintMakerRelatable {
|
|||
return self
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use lastBaseline instead")
|
||||
@available(*, deprecated, message:"Use lastBaseline instead")
|
||||
public var baseline: ConstraintMakerExtendable {
|
||||
self.description.attributes += .lastBaseline
|
||||
return self
|
||||
|
|
|
@ -42,25 +42,25 @@ public class ConstraintMakerPriortizable: ConstraintMakerFinalizable {
|
|||
return self
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use priority(.required) instead.")
|
||||
@available(*, deprecated, message:"Use priority(.required) instead.")
|
||||
@discardableResult
|
||||
public func priorityRequired() -> ConstraintMakerFinalizable {
|
||||
return self.priority(.required)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use priority(.high) instead.")
|
||||
@available(*, deprecated, message:"Use priority(.high) instead.")
|
||||
@discardableResult
|
||||
public func priorityHigh() -> ConstraintMakerFinalizable {
|
||||
return self.priority(.high)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use priority(.medium) instead.")
|
||||
@available(*, deprecated, message:"Use priority(.medium) instead.")
|
||||
@discardableResult
|
||||
public func priorityMedium() -> ConstraintMakerFinalizable {
|
||||
return self.priority(.medium)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use priority(.low) instead.")
|
||||
@available(*, deprecated, message:"Use priority(.low) instead.")
|
||||
@discardableResult
|
||||
public func priorityLow() -> ConstraintMakerFinalizable {
|
||||
return self.priority(.low)
|
||||
|
|
|
@ -30,122 +30,122 @@
|
|||
|
||||
public extension ConstraintView {
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_left: ConstraintItem { return self.snp.left }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_left: ConstraintItem { return self.snp.left }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_top: ConstraintItem { return self.snp.top }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_top: ConstraintItem { return self.snp.top }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_right: ConstraintItem { return self.snp.right }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_right: ConstraintItem { return self.snp.right }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_bottom: ConstraintItem { return self.snp.bottom }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_bottom: ConstraintItem { return self.snp.bottom }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_leading: ConstraintItem { return self.snp.leading }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_leading: ConstraintItem { return self.snp.leading }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_trailing: ConstraintItem { return self.snp.trailing }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_trailing: ConstraintItem { return self.snp.trailing }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_width: ConstraintItem { return self.snp.width }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_width: ConstraintItem { return self.snp.width }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_height: ConstraintItem { return self.snp.height }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_height: ConstraintItem { return self.snp.height }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_centerX: ConstraintItem { return self.snp.centerX }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_centerX: ConstraintItem { return self.snp.centerX }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_centerY: ConstraintItem { return self.snp.centerY }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_centerY: ConstraintItem { return self.snp.centerY }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_baseline: ConstraintItem { return self.snp.baseline }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_baseline: ConstraintItem { return self.snp.baseline }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, OSX 10.11, *)
|
||||
public var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
|
||||
var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, OSX 10.11, *)
|
||||
public var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
|
||||
var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
|
||||
var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_topMargin: ConstraintItem { return self.snp.topMargin }
|
||||
var snp_topMargin: ConstraintItem { return self.snp.topMargin }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
|
||||
var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
|
||||
var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
|
||||
var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
|
||||
var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
|
||||
var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
|
||||
var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_edges: ConstraintItem { return self.snp.edges }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_edges: ConstraintItem { return self.snp.edges }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_size: ConstraintItem { return self.snp.size }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_size: ConstraintItem { return self.snp.size }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public var snp_center: ConstraintItem { return self.snp.center }
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
var snp_center: ConstraintItem { return self.snp.center }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_margins: ConstraintItem { return self.snp.margins }
|
||||
var snp_margins: ConstraintItem { return self.snp.margins }
|
||||
|
||||
@available(iOS, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
@available(iOS, deprecated, message:"Use newer snp.* syntax.")
|
||||
@available(iOS 8.0, *)
|
||||
public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
|
||||
var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
|
||||
return self.snp.prepareConstraints(closure)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||
self.snp.makeConstraints(closure)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||
self.snp.remakeConstraints(closure)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
|
||||
self.snp.updateConstraints(closure)
|
||||
}
|
||||
|
||||
@available(*, deprecated:3.0, message:"Use newer snp.* syntax.")
|
||||
public func snp_removeConstraints() {
|
||||
@available(*, deprecated, message:"Use newer snp.* syntax.")
|
||||
func snp_removeConstraints() {
|
||||
self.snp.removeConstraints()
|
||||
}
|
||||
|
||||
public var snp: ConstraintViewDSL {
|
||||
var snp: ConstraintViewDSL {
|
||||
return ConstraintViewDSL(view: self)
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
public extension LayoutConstraint {
|
||||
|
||||
override public var description: String {
|
||||
override var description: String {
|
||||
var description = "<"
|
||||
|
||||
description += descriptionForObject(self)
|
||||
|
@ -82,6 +82,9 @@ private func descriptionForRelation(_ relation: LayoutRelation) -> String {
|
|||
case .equal: return "=="
|
||||
case .greaterThanOrEqual: return ">="
|
||||
case .lessThanOrEqual: return "<="
|
||||
#if swift(>=5.0)
|
||||
@unknown default: return "unknown"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +112,10 @@ private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String {
|
|||
case .trailingMargin: return "trailingMargin"
|
||||
case .centerXWithinMargins: return "centerXWithinMargins"
|
||||
case .centerYWithinMargins: return "centerYWithinMargins"
|
||||
}
|
||||
#if swift(>=5.0)
|
||||
@unknown default: return "unknown"
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
switch attribute {
|
||||
case .notAnAttribute: return "notAnAttribute"
|
||||
|
@ -125,7 +131,10 @@ private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String {
|
|||
case .centerY: return "centerY"
|
||||
case .lastBaseline: return "lastBaseline"
|
||||
case .firstBaseline: return "firstBaseline"
|
||||
}
|
||||
#if swift(>=5.0)
|
||||
@unknown default: return "unknown"
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
@available(iOS 8.0, *)
|
||||
public extension ConstraintLayoutSupport {
|
||||
|
||||
public var snp: ConstraintLayoutSupportDSL {
|
||||
var snp: ConstraintLayoutSupportDSL {
|
||||
return ConstraintLayoutSupportDSL(support: self)
|
||||
}
|
||||
|
||||
|
|
|
@ -494,8 +494,8 @@ class SnapKitTests: XCTestCase {
|
|||
|
||||
#if os(iOS) || os(tvOS)
|
||||
func testEdgesToMargins() {
|
||||
var fromAttributes = Set<NSLayoutAttribute>()
|
||||
var toAttributes = Set<NSLayoutAttribute>()
|
||||
var fromAttributes = Set<LayoutAttribute>()
|
||||
var toAttributes = Set<LayoutAttribute>()
|
||||
|
||||
let view = View()
|
||||
self.container.addSubview(view)
|
||||
|
|
Loading…
Reference in New Issue