SwiftUI Maps on Apple Watch - User Location?

How do you get the Maps in SwiftUI to show the User Location on the Apple Watch?

Code Block
Map(coordinateRegion: $mapSetupRegion, interactionModes: mapInteractionModes, showsUserLocation: mapShowUserLocation, userTrackingMode: $mapTrackingMode )

These are the variables we have been using.

Code Block
    @State private var mapTrackingMode = MapUserTrackingMode.follow
    private var mapShowUserLocation = true
    private var mapInteractionModes = MapInteractionModes.all
   
    @State private var mapSetupRegion = MKCoordinateRegion(
            center: CLLocationCoordinate2D(
                latitude  : 37.3318,longitude : -122.0312),
            span: MKCoordinateSpan(  latitudeDelta  : 0.1, longitudeDelta : 0.1   )
        )


Thanks.


Replies

Make sure your app is authorized for location. Your app can request authorization as follows:
Code Block
let manager = CLLocationManager()
manager.requestWhenInUseAuthorization()
You may need to set the map tracking mode to .follow again once you have received location authorization. You can try setting it in locationManagerDidChangeAuthorization(_:).