File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -59,24 +59,23 @@ final class RootViewController: UIViewController {
5959 childWidget? . removeFromParentWidget ( )
6060 child. removeFromParentWidget ( )
6161
62- let childController = child. controller
6362 view. addSubview ( child. view)
64- if let childController {
65- addChild ( childController)
66- childController. didMove ( toParent: self )
67- }
68- childWidget = child
69-
70-
71-
72- /*NSLayoutConstraint.activate([
73- child.view.widthAnchor.constraint(equalTo: viewAnchor.widthAnchor),
74- child.view.heightAnchor.constraint(equalTo: viewAnchor.heightAnchor),
75- ])*/
76-
77- child. view. frame = view. bounds
7863 child. view. autoresizingMask = [ . flexibleWidth, . flexibleHeight]
64+ childWidget = child
65+
66+ // Force layout immediately if view already has bounds
67+ if view. bounds != . zero {
68+ child. view. frame = view. bounds
69+ }
70+ }
71+
72+ override func viewDidLayoutSubviews( ) {
73+ super. viewDidLayoutSubviews ( )
74+ if let child = childWidget {
75+ child. view. frame = view. bounds
76+ }
7977 }
78+
8079}
8180
8281extension UIKitBackend {
You can’t perform that action at this time.
0 commit comments