mirror of https://github.com/SnapKit/SnapKit
Revert "[EXC_BAD_ACCESS] Update LayoutConstraint == operator to support iOS 10 and higher changes (#574)" (#593)
This reverts commit bc2b0b9332
.
This commit is contained in:
parent
e9b237468b
commit
f59340c39b
|
@ -44,18 +44,14 @@ public class LayoutConstraint : NSLayoutConstraint {
|
|||
}
|
||||
|
||||
internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
|
||||
let areLayoutAnchorsEqual: Bool
|
||||
if #available(iOS 10.0, OSXApplicationExtension 10.12, *) {
|
||||
areLayoutAnchorsEqual = lhs.firstAnchor === rhs.firstAnchor &&
|
||||
lhs.secondAnchor === rhs.secondAnchor
|
||||
} else {
|
||||
areLayoutAnchorsEqual = lhs.firstItem === rhs.firstItem &&
|
||||
lhs.secondItem === rhs.secondItem &&
|
||||
lhs.firstAttribute == rhs.firstAttribute &&
|
||||
lhs.secondAttribute == rhs.secondAttribute
|
||||
guard lhs.firstItem === rhs.firstItem &&
|
||||
lhs.secondItem === rhs.secondItem &&
|
||||
lhs.firstAttribute == rhs.firstAttribute &&
|
||||
lhs.secondAttribute == rhs.secondAttribute &&
|
||||
lhs.relation == rhs.relation &&
|
||||
lhs.priority == rhs.priority &&
|
||||
lhs.multiplier == rhs.multiplier else {
|
||||
return false
|
||||
}
|
||||
return areLayoutAnchorsEqual &&
|
||||
lhs.relation == rhs.relation &&
|
||||
lhs.priority == rhs.priority &&
|
||||
lhs.multiplier == rhs.multiplier
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -580,34 +580,4 @@ class SnapKitTests: XCTestCase {
|
|||
let higherPriority: ConstraintPriority = ConstraintPriority.high.advanced(by: 1)
|
||||
XCTAssertEqual(higherPriority.value, highPriority.value + 1)
|
||||
}
|
||||
|
||||
func testLayoutConstraintEqual() {
|
||||
let view1 = View()
|
||||
let view2 = View()
|
||||
let layoutConstraint1 = LayoutConstraint(item: view1,
|
||||
attribute: .top,
|
||||
relatedBy: .lessThanOrEqual,
|
||||
toItem: view2,
|
||||
attribute: .bottom,
|
||||
multiplier: 2,
|
||||
constant: 30)
|
||||
let layoutConstraint2 = LayoutConstraint(item: view1,
|
||||
attribute: .top,
|
||||
relatedBy: .lessThanOrEqual,
|
||||
toItem: view2,
|
||||
attribute: .bottom,
|
||||
multiplier: 2,
|
||||
constant: 30)
|
||||
let layoutConstraint3 = LayoutConstraint(item: view1,
|
||||
attribute: .top,
|
||||
relatedBy: .lessThanOrEqual,
|
||||
toItem: view2,
|
||||
attribute: .bottom,
|
||||
multiplier: 1,
|
||||
constant: 50)
|
||||
XCTAssertTrue(layoutConstraint1 == layoutConstraint2)
|
||||
XCTAssertFalse(layoutConstraint1 == layoutConstraint3)
|
||||
XCTAssertFalse(layoutConstraint2 == layoutConstraint3)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue