Created
February 3, 2021 15:13
-
-
Save LucasVanDongen/b11109b2f427138b1c93ec5cf18a5199 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewControllerRepresentable.swift | |
// | |
// Created by Lucas van Dongen on 03/02/2021. | |
// | |
import SwiftUI | |
/// Helps you hosting the UIViewControllers in a simple way for Previews | |
struct ViewControllerRepresentable<Controller: UIViewController>: UIViewControllerRepresentable { | |
/// Add the code to initialize the UIViewController you want to preview here | |
let initializer: () -> Controller | |
func makeCoordinator() -> Coordinator { | |
return Coordinator() | |
} | |
func makeUIViewController(context: Context) -> Controller { | |
return initializer() | |
} | |
func updateUIViewController(_ uiViewController: Controller, context: Context) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment