From ad651a57525576fbdf2c66fc5f164ae43d399e5e Mon Sep 17 00:00:00 2001 From: Jake Wharton Date: Mon, 25 Sep 2023 16:38:28 -0400 Subject: [PATCH] Stick to the safe area when rendering test app --- .../ios-uikit/TestApp/TestAppViewController.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test-app/ios-uikit/TestApp/TestAppViewController.swift b/test-app/ios-uikit/TestApp/TestAppViewController.swift index e89c48808a..1bd9c6660d 100644 --- a/test-app/ios-uikit/TestApp/TestAppViewController.swift +++ b/test-app/ios-uikit/TestApp/TestAppViewController.swift @@ -30,9 +30,7 @@ class TestAppViewController : UIViewController { super.viewDidLoad() view.backgroundColor = .white - } - override func loadView() { let testAppLauncher = TestAppLauncher(nsurlSession: urlSession, hostApi: IosHostApi()) let treehouseApp = testAppLauncher.createTreehouseApp() let widgetSystem = TestSchemaWidgetSystem() @@ -42,7 +40,15 @@ class TestAppViewController : UIViewController { codeListener: CodeListener() ) ExposedKt.bindWhenReady(content: content, view: treehouseView) - view = treehouseView.view + + let tv = treehouseView.view + tv.translatesAutoresizingMaskIntoConstraints = false + + self.view.addSubview(tv) + let safeGuide = self.view.safeAreaLayoutGuide + tv.heightAnchor.constraint(equalTo: safeGuide.heightAnchor).isActive = true + tv.widthAnchor.constraint(equalTo: safeGuide.widthAnchor).isActive = true + tv.topAnchor.constraint(equalTo: safeGuide.topAnchor).isActive = true } }