Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could you add an example? #4

Open
erksch opened this issue Jan 1, 2024 · 1 comment
Open

Could you add an example? #4

erksch opened this issue Jan 1, 2024 · 1 comment

Comments

@erksch
Copy link

erksch commented Jan 1, 2024

Hey there!

The premise of this component sounds like what I am looking for (getting touches through a UIHostingController) but I do not understand how to use HostingParentController. Where do I pass my SwiftUI View?

In the screenshot in the README you initialize some UIHostingControllers but it is not clear where the variables are used.
It would be helpful to have some more example code in the README :)

@erksch
Copy link
Author

erksch commented Jan 4, 2024

Ok, I got it :) Probably looks something like this:

class SeniorCareSpeechUIViewController: HostingParentController {
    let hostingController = UIHostingController(rootView: MySwiftUIView)

    override func viewDidLoad() {
        super.viewDidLoad()

        addChild(hostingController)
        view.addSubview(hostingController.view)
        hostingController.didMove(toParent: self)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant