Skip to content

Commit 1efc178

Browse files
authored
Merge pull request #1233 from OrkhanAlikhanov/layout-order-fix
Fixed Layout breaks subview ordering
2 parents 3677b26 + 6191e01 commit 1efc178

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/iOS/Layout/Layout.swift

+4-1
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)