0

I have used makeUiView() and updateUiView() methods in a UiViewRepresentable struct to create my mapview.

struct GoogleMapView: UIViewRepresentable {
    func updateUIView(_ uiView: GMSMapView, context: Context) {
        let marker : GMSMarker = GMSMarker()
        marker.position = CLLocationCoordinate2D(latitude: 20, longitude: 50);
        marker.map = uiView;
    } 

    func makeUIView(context: Context) -> GMSMapView {
        let camera = GMSCameraPosition.camera(withLatitude: 20, longitude: 50,zoom: 10)
        let mapView  = GMSMapView(frame: CGRect.zero, camera: camera)
        mapView.delegate = ViewController()
        return mapView
    }
}

I want to nevigate to a different view if i click the marker on the map.I have found that i have to use GMSMapViewDelegate and mapView() function for that.But currently i am not using any ValueControler in my project.Also where to make mapView.delegate = self?

Santanu
  • 337
  • 1
  • 3
  • 13

0 Answers0