Skip to content

Instantly share code, notes, and snippets.

@MojtabaHs
Last active September 17, 2020 04:44
Show Gist options
  • Save MojtabaHs/08ef36acf40aeb7febdfddd71f9d232a to your computer and use it in GitHub Desktop.
Save MojtabaHs/08ef36acf40aeb7febdfddd71f9d232a 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