Search code examples
iosswiftgoogle-maps-sdk-ios

Use of didBeginDragging


I want to use the function didBeginDragging to execute code when an user drag a marker on a map. I use this code but It's doesn't work...

extension ViewController: GMSMapViewDelegate{

    func mapView(_ mapView: GMSMapView, didBeginDragging marker: GMSMarker) {
        print("didBeginDragging")
    }

    func mapView(_ mapView: GMSMapView, didDrag marker: GMSMarker) {
        print("didDrag")
    }

    func mapView(_ mapView: GMSMapView, didEndDragging marker: GMSMarker) {
        print("didEndDragging")
    }
}

I have the version 2.0.1 of GoogleMapsSDK, it is the problem ?

Do you have an idea to solve my problem ? Thanks


Solution

  • You need to set the delegate of the map view, just implementing the delegate won't work.