Skip to content

_UIHostingView deinit crash #87

@Kyle-Ye

Description

@Kyle-Ye
image
@MainActor
@Test
func testDemo() throws {
    struct ContentView: View {
        var name = ""
        var body: some View {
            AnyView(EmptyView())
        }
    }
    let vc = UIHostingController(rootView: ContentView())
    vc.triggerLayout()
}
extension UIHostingController {
    func triggerLayout() {
        let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
        window.rootViewController = self
        window.makeKeyAndVisible()
        view.layoutSubviews()
    }
}

Commit Hash: a166851

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: hosting-bridgeSwiftUI bridge, UIHosting/NSHosting, representables, and platform host views.area: testsTest suites, UI tests, fixtures, snapshots, and test support code.area: viewView APIs, modifiers, AnyView, ForEach, DynamicView, and related behavior.contrib: help wantedPR contribution is appreciated.impact: crashCrash, assertion, or fatal runtime failure.platform: iOSiOS-specific behavior or support.priority: p1Medium priority.type: bugSomething is not working correctly.type: testsTest coverage, test infrastructure, snapshots, or test-only changes.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions