1

I have a line of Swift that sets the center of the map to an annotation that was tapped.

mapView.setCenter(annotation.coordinate, animated: true)

However, this animation is too fast. Is there a way to slow it down?

Ahmad F
  • 30,560
  • 17
  • 97
  • 143

1 Answers1

2

You don't need to call setCenter(_:animated:), at this point. What you could do is to directly set a value for centerCoordinate inside UIView animation function:

// set your needed time per second, the current is 3.0 seconds
UIView.animate(withDuration: 3.0) { 
    self.mapView.centerCoordinate = annotation.coordinate
}
Ahmad F
  • 30,560
  • 17
  • 97
  • 143