setRegion(_:animated:)
Changes the currently visible region, and optionally animates the change.
Declaration
func setRegion(_ region: MKCoordinateRegion, animated: Bool)Parameters
Discussion
Changing just the center coordinate of the region can still cause the span values to change implicitly. The span values might change because the distances that a span repesents change at different latitudes and longitudes, and the map view may need to adjust the span to account for the new location. If you want to change the center coordinate without changing the zoom level, use the setCenter(_:animated:) instead.
When setting a new region, the map may adjust the value in the region parameter so that it fits the visible area of the map precisely. This adjustment ensures that the value in the region property reflects the visible portion of the map. However, it does mean that if you get the value of that property right after calling this method, the returned value may not match the value you set. You can use the regionThatFits(_:) method to determine the region that the map sets.