Skip to content

Commit ceac733

Browse files
author
JWI
committed
a
1 parent 8642b54 commit ceac733

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Sources/UIKitBackend/UIKitBackend+Window.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,14 @@ final class RootViewController: UIViewController {
5454
child.removeFromParentWidget()
5555

5656
view.addSubview(child.view)
57-
child.view.backgroundColor = .red
58-
child.view.isHidden = false
59-
child.view.alpha = 1
60-
child.view.frame = view.bounds
6157
child.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
58+
child.view.translatesAutoresizingMaskIntoConstraints = false
59+
childWidget = child
6260

63-
if let childController = child.controller, childController.parent == nil {
64-
addChild(childController)
65-
childController.didMove(toParent: self)
61+
// Force layout immediately if view already has bounds
62+
if view.bounds != .zero {
63+
child.view.frame = view.bounds
6664
}
67-
68-
childWidget = child
6965
}
7066

7167
override func viewDidLayoutSubviews() {

0 commit comments

Comments
 (0)