how to change custom compass on Google Map IOS?

32 Views Asked by At

I can't figure out how to change the compass needle or make my own as in the picture. Here is my code:

    func makeUIView(context: Self.Context) -> GMSMapView {
    let options = GMSMapViewOptions()
    options.camera = GMSCameraPosition.camera(withLatitude: locationManager.latitude, longitude: locationManager.longitude, zoom: zoom)
    let mapView = GMSMapView(options:options)
    mapView.isMyLocationEnabled = true


    // Load and apply map style
    do {
          // Set the map style by passing the URL of the local file.
        if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json") {
            mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
          } else {
            NSLog("Unable to find style.json")
          }
        } catch {
          NSLog("One or more of the map styles failed to load. \(error)")
        }

    return mapView
}

func updateUIView(_ mapView: GMSMapView, context: Context) {
    mapView.animate(toLocation: CLLocationCoordinate2D(latitude: locationManager.latitude, longitude: locationManager.longitude))
    // Create a custom marker for the current location
     let marker = GMSMarker()
     marker.position = CLLocationCoordinate2D(latitude: locationManager.latitude, longitude: locationManager.longitude)
     marker.iconView = UIImageView(image: UIImage(named: "icon_pin")) // Replace "custom_marker" with the name of your custom marker image file
     marker.map = mapView
}

It looks like this now: enter image description here

how do I fix the code to make it look like this? -> enter image description here

0

There are 0 best solutions below