SwiftUI Map: is it possible to add an inset to the map visible rectangle?

In UIKit, we can add an insets to a MKMapView with setVisibleMapRect to have additional space around a specified MKMapRect. It's useful for UIs like Apple Maps or FlightyApp (see first screenshot attached). This means we can have a modal sheet above the map but still can see all the content added to the map.

I'm trying to do the same for a SwiftUI Map (on iOS 17) but I can't find a way to do it: see screenshot 2 below. Is it possible to obtain the same result or should I file a feedback for an improvement?

  • Really interested in this too!

Add a Comment

Replies

Try something like Map().contentMargins(.bottom, currentDetentHeight). It's working so far for MapCameraPosition.automatic and annotations.