@@ -30,22 +30,24 @@ public class RelationalConstraintBuilder: ConstraintBuilder {
3030 init ( first firstConstrainable: Constrainable , second secondConstrainable: Constrainable ) {
3131 self . firstConstrainable = firstConstrainable
3232 self . secondConstrainable = secondConstrainable
33-
34- if let view = firstConstrainable as? UIView {
35- view. translatesAutoresizingMaskIntoConstraints = false
36- if view. superview == nil {
33+
34+ UIView . performWithoutAnimation {
35+ if let view = firstConstrainable as? UIView {
36+ view. translatesAutoresizingMaskIntoConstraints = false
37+ if view. superview == nil {
38+ if let otherView = secondConstrainable as? UIView {
39+ otherView. addSubview ( view)
40+ } else if let otherLayoutGuide = secondConstrainable as? UILayoutGuide , let otherView = otherLayoutGuide. owningView {
41+ otherView. addSubview ( view)
42+ }
43+ }
44+ } else if let layoutGuide = firstConstrainable as? UILayoutGuide , layoutGuide. owningView == nil {
3745 if let otherView = secondConstrainable as? UIView {
38- otherView. addSubview ( view )
39- } else if let otherLayoutGuide = secondConstrainable as? UILayoutGuide , let otherView = otherLayoutGuide . owningView {
40- otherView. addSubview ( view )
46+ otherView. addLayoutGuide ( layoutGuide )
47+ } else if let otherGuide = secondConstrainable as? UILayoutGuide , let otherView = otherGuide . owningView {
48+ otherView. addLayoutGuide ( layoutGuide )
4149 }
4250 }
43- } else if let layoutGuide = firstConstrainable as? UILayoutGuide , layoutGuide. owningView == nil {
44- if let otherView = secondConstrainable as? UIView {
45- otherView. addLayoutGuide ( layoutGuide)
46- } else if let otherGuide = secondConstrainable as? UILayoutGuide , let otherView = otherGuide. owningView {
47- otherView. addLayoutGuide ( layoutGuide)
48- }
4951 }
5052 }
5153}
0 commit comments