Post

Replies

Boosts

Views

Activity

SwiftUI MapKit use of UserLocation struct
I have a map where I am using UserAnnotation() to show the user's location. Location permissions are handled elsewhere in the app. If the user has previously granted location permission, that is enough for the UserAnnotation() blue pin to appear. Otherwise, it just doesn't draw. So the Map already knows the user's permission and location without my code again requesting location etc. I was looking for a way to leverage the map's knowledge of the user's location and came across this struct as described in the Documentation for SwiftUI Mapkit public struct UserLocation { public var heading: CLHeading? public var location: CLLocation? } I thought this struct might expose the user's location, but how it is expected to be used or when it should populated is unknown from the point of the documentation. Would someone please share the purpose and use of this struct?
1
1
302
Jan ’25