Forked from MojtabaHs/UIViewControllerForSwiftUI.swift
Created
September 17, 2020 04:44
-
-
Save arthurdapaz/fd963626cf7f169f162bd796836dfbf0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#if DEBUG | |
import SwiftUI | |
protocol UIViewControllerRepresentableHelper: UIViewControllerRepresentable { | |
var configuration: (UIViewControllerType) -> () { get set } | |
} | |
extension UIViewControllerRepresentableHelper { | |
func makeUIViewController(context: Context) -> UIViewControllerType { UIViewControllerType() } | |
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { configuration(uiViewController) } | |
} | |
#endif | |
// MARK: - Usage: | |
struct <#UIViewControllerForSwiftUI#>: UIViewControllerRepresentableHelper { | |
typealias UIViewControllerType = TripDetailsCollectionViewController | |
var configuration = { (view: UIViewControllerType) in } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment