TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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 RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.