Skip to content

Commit 6191e01

Browse files
Fixed Layout breaks subview ordering
1 parent 3677b26 commit 6191e01

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/iOS/Layout/Layout.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ public extension UIView {
4141
- Returns: A Layout instance.
4242
*/
4343
func layout(_ child: UIView) -> Layout {
44-
addSubview(child)
44+
if self != child.superview {
45+
addSubview(child)
46+
}
47+
4548
child.translatesAutoresizingMaskIntoConstraints = false
4649
return child.layout
4750
}

0 commit comments

Comments
 (0)