Skip to content

Instantly share code, notes, and snippets.

@alexklyuev
Created June 29, 2024 17:34
Show Gist options
  • Save alexklyuev/5ab995ac6f5fdd5c7f343b0843d4deb6 to your computer and use it in GitHub Desktop.
Save alexklyuev/5ab995ac6f5fdd5c7f343b0843d4deb6 to your computer and use it in GitHub Desktop.
Use SwiftUI view as ExpoView
import SwiftUI
import ExpoModulesCore
class ModuleContainerView: ExpoView {
var hostingController: UIHostingController<some View> = UIHostingController(rootView: ModuleContentView())
required public init(appContext: AppContext? = nil) {
super.init(appContext: appContext)
hostingController.view.backgroundColor = .clear
hostingController.view.frame = self.bounds
hostingController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(hostingController.view)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment