---
title: "setCenter(_:animated:)"
framework: mapkit
role: symbol
role_heading: Instance Method
path: "mapkit/mkmapview/setcenter(_:animated:)"
---

# setCenter(_:animated:)

Changes the center coordinate of the map, and optionally animates the change.

## Declaration

```swift
func setCenter(_ coordinate: CLLocationCoordinate2D, animated: Bool)
```

## Parameters

- `coordinate`: The new center coordinate for the map.
- `animated`: Specify doc://com.apple.documentation/documentation/Swift/true if you want the map view to scroll to the new location or doc://com.apple.documentation/documentation/Swift/false if you want the map to display the new location immediately.

## Discussion

Discussion Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. It also updates the value in the region property to reflect the new center coordinate and the new span values needed to maintain the current zoom level.

## See Also

### Manipulating the visible portion of the map

- [region](mapkit/mkmapview/region.md)
- [setRegion(_:animated:)](mapkit/mkmapview/setregion(_:animated:).md)
- [centerCoordinate](mapkit/mkmapview/centercoordinate.md)
- [showAnnotations(_:animated:)](mapkit/mkmapview/showannotations(_:animated:).md)
- [visibleMapRect](mapkit/mkmapview/visiblemaprect.md)
- [setVisibleMapRect(_:animated:)](mapkit/mkmapview/setvisiblemaprect(_:animated:).md)
- [setVisibleMapRect(_:edgePadding:animated:)](mapkit/mkmapview/setvisiblemaprect(_:edgepadding:animated:).md)
