I am working on a SwiftUI project, in my app i have to show a map, i am able to show map using UIViewRepresentable
, now that map view will have a button and on tapping on that button mapview will needs to show controller (full screen direction) view and i know i can do this using UIViewControllerRepresentable
.
I need help in which how can i show the UIViewControllerRepresentable
from button click of UIViewRepresentable
Till now what i have done is, adding my code :
On button click i am calling showDetailMap
function which calls the MapDetailViewController
, but some how MapDetailViewController
is not opening as model.
private func showDetailMap() {
MapDetailViewController()
}
struct MapDetailViewController: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> MapDetailViewController {
let viewController: MapDetailViewController = MapDetailViewController()
return viewController
}
func updateUIViewController(_ uiViewController: MapDetailViewController, context: Context) {}
}
Please help me with this.