mirror of https://github.com/SnapKit/SnapKit
Fix layout constraint comparison
This commit is contained in:
parent
5b0282cf8b
commit
c904582015
|
@ -44,9 +44,21 @@ public class LayoutConstraint : NSLayoutConstraint {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
|
internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
|
||||||
guard lhs.firstItem === rhs.firstItem &&
|
// ensure first anchor items match
|
||||||
lhs.secondItem === rhs.secondItem &&
|
guard let item1 = lhs.firstAnchor.item,
|
||||||
lhs.firstAttribute == rhs.firstAttribute &&
|
let item2 = rhs.firstAnchor.item,
|
||||||
|
item1 === item2 else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure second anchor items match
|
||||||
|
guard ((lhs.secondAnchor?.item == nil && rhs.secondAnchor?.item == nil) ||
|
||||||
|
(lhs.secondAnchor?.item === rhs.secondAnchor?.item)) else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure attributes, relation, priorty and multiplier match
|
||||||
|
guard lhs.firstAttribute == rhs.firstAttribute &&
|
||||||
lhs.secondAttribute == rhs.secondAttribute &&
|
lhs.secondAttribute == rhs.secondAttribute &&
|
||||||
lhs.relation == rhs.relation &&
|
lhs.relation == rhs.relation &&
|
||||||
lhs.priority == rhs.priority &&
|
lhs.priority == rhs.priority &&
|
||||||
|
|
Loading…
Reference in New Issue