Skip to content

Commit 5a2935f

Browse files
author
JWI
committed
testing
1 parent 6a7813a commit 5a2935f

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

Sources/UIKitBackend/UIKitBackend+Window.swift

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

6262
view.addSubview(child.view)
63-
child.view.backgroundColor = .red
64-
child.view.isHidden = false
65-
child.view.alpha = 1
66-
child.view.frame = view.bounds
6763
child.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
64+
child.view.translatesAutoresizingMaskIntoConstraints = false
65+
childWidget = child
6866

69-
if let childController = child.controller, childController.parent == nil {
70-
addChild(childController)
71-
childController.didMove(toParent: self)
67+
// Force layout immediately if view already has bounds
68+
if view.bounds != .zero {
69+
child.view.frame = view.bounds
7270
}
73-
74-
childWidget = child
7571
}
7672

7773
override func viewDidLayoutSubviews() {

Sources/UIKitBackend/UIKitBackend.swift

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,23 @@ open class ApplicationDelegate: UIResponder, UIApplicationDelegate {
214214
_ application: UIApplication,
215215
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
216216
) -> Bool {
217-
if let onReceiveURL = UIKitBackend.onReceiveURL,
218-
let url = launchOptions?[.url] as? URL
219-
{
220-
onReceiveURL(url)
221-
}
222-
217+
// 1. Create the backend
218+
let backend = UIKitBackend()
219+
220+
// 2. Create the main window
221+
let window = backend.createWindow(withDefaultSize: nil)
222+
self.window = window
223+
224+
// 3. Create a simple widget to test
225+
let rect = BaseViewWidget()
226+
rect.backgroundColor = .blue
227+
228+
// 4. Set the widget as the child of the window
229+
backend.setChild(ofWindow: window, to: rect)
230+
231+
// 5. Show the window
232+
backend.show(window: window)
233+
223234
return true
224235
}
225236

0 commit comments

Comments
 (0)