<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.2.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MKMapView/mapRectThatFits(_:edgePadding:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MKMapView(im)mapRectThatFits:edgePadding:"
  },
  "title" : "mapRectThatFits(_:edgePadding:)"
}
-->

# mapRectThatFits(_:edgePadding:)

Returns a centered, inset map rectangle with the same aspect ratio as the map view’s frame.

iOS, iPadOS, Mac Catalyst, tvOS, visionOS:

```
func mapRectThatFits(_ mapRect: MKMapRect, edgePadding insets: UIEdgeInsets) -> MKMapRect
```

macOS:

```
func mapRectThatFits(_ mapRect: MKMapRect, edgePadding insets: NSEdgeInsets) -> MKMapRect
```

## Parameters

`mapRect`

The initial map rectangle with the width and height you want to adjust.

`insets`

The distance (in screen points) by which to inset the returned rectangle from the actual boundaries of the map view’s frame.

## Return Value

MapKit centers the map rectangle on the same point of the map, and adjusts the width and height to fit in the map view’s frame, minus its inset values.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)