According to documentation you can change marker position with animation:
Marker position. Animated.
Do you know how to disable this animation?
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.
As implemented in google maps samples, you should use CATransaction
for this purpose.
let changedPosition = CLLocationCoordinate2DMake(22.9734, 78.6569)
CATransaction.begin()
CATransaction.setAnimationDuration(0.0)
marker.position = changedPosition
CATransaction.commit()
Source demo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With