Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arthurdapaz/fd963626cf7f169f162bd796836dfbf0 to your computer and use it in GitHub Desktop.
Save arthurdapaz/fd963626cf7f169f162bd796836dfbf0 to your computer and use it in GitHub Desktop.
#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