UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

MapKit Course heading

Forums > SwiftUI

Hello all! I wish you all well.

I am looking into Mapkit and have successfully recieved the course heading. I am using the parameter to adjust the heading for the camera while tracking the user.

It adjust the camera when the map is loaded, so I know its working, but does not update. I placed the camera in the func updateUi method, yet this makes the map stutter when tracking the users.

What would be an efficient uodate method for the course heading while tracking the user.

Any help is much appreciated.

cheers! Chris

2      

I am looking for some advanced tuts for MKMapCamera if anyone has suggestions.

I have achieved this for now, hoping that it will help someone else. Although Im not sure if this is the correct method, I am using.......

func makeUIView(context: Context) -> MKMapView { let mapView = MKMapView(frame: UIScreen.main.bounds) mapView.camera.heading = locationManager.currentCourse ?? CLLocationDirection() mapView.setCamera(mapView.camera, animated: true) mapView.delegate = context.coordinator }

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.