File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,21 @@ public class LayoutConstraint : NSLayoutConstraint {
44
44
}
45
45
46
46
internal func == ( lhs: LayoutConstraint , rhs: LayoutConstraint ) -> Bool {
47
- guard lhs. firstItem === rhs. firstItem &&
48
- lhs. secondItem === rhs. secondItem &&
49
- lhs. firstAttribute == rhs. firstAttribute &&
47
+ // ensure first anchor items match
48
+ guard let item1 = lhs. firstAnchor. item,
49
+ let item2 = rhs. firstAnchor. item,
50
+ item1 === item2 else {
51
+ return false
52
+ }
53
+
54
+ // ensure second anchor items match
55
+ guard ( ( lhs. secondAnchor? . item == nil && rhs. secondAnchor? . item == nil ) ||
56
+ ( lhs. secondAnchor? . item === rhs. secondAnchor? . item) ) else {
57
+ return false
58
+ }
59
+
60
+ // ensure attributes, relation, priorty and multiplier match
61
+ guard lhs. firstAttribute == rhs. firstAttribute &&
50
62
lhs. secondAttribute == rhs. secondAttribute &&
51
63
lhs. relation == rhs. relation &&
52
64
lhs. priority == rhs. priority &&
You can’t perform that action at this time.
0 commit comments