Skip to content

Instantly share code, notes, and snippets.

@bocato
Created February 14, 2022 16:52
Show Gist options
  • Save bocato/021133c7668d78efda41e69f169ad11b to your computer and use it in GitHub Desktop.
Save bocato/021133c7668d78efda41e69f169ad11b to your computer and use it in GitHub Desktop.
struct ToSwiftUIView<UIKitView: UIView>: UIViewRepresentable {
typealias UIViewType = UIKitView
let uikitView: () -> UIKitView
func makeUIView(context: Context) -> UIKitView {
uikitView()
}
func updateUIView(_ uiView: UIKitView, context: Context) {}
}
struct ToSwiftUIController: UIViewControllerRepresentable {
let viewController: () -> UIViewController
func makeUIViewController(context: Context) -> UIViewController {
self.viewController()
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment