Just a quick, minor correction... per documentation, the .task body gets executed before the view appears.
Also, an idea came to me that the map's position is first set to .automatic in my suggestion. Replacing it with .userLocation later correctly follows the user's heading. The .task view modifier is just one way to achieve this replacement. Just as long as the .userLocation isn't the first MapCameraPosition assigned to Map.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: