How to disable animation for changing GMSMarker position in iOS?

google-maps, google-maps-sdk-ios, ios, swift

Solution

Suppose your reference for marker is `mainMarker` which is a `GMSMarker` object

var mainMarker:GMSMarker?

And suppose this is your function to change marker position without animation

func changeMarkerWithoutAnimation() {
    mainMarker?.map = nil
    mainMarker = nil
    let changedPosition = CLLocationCoordinate2DMake(22.9734, 78.6569)
    mainMarker = GMSMarker(position: changedPosition)
    mainMarker?.title = "Hello World"
    mainMarker!.map = mapView
}

This will change your marker's position without animation.

Problem

According to documentation you can change marker position with animation: Marker position. Animated. Do you know how to disable this animation?

Original source

Related problems