How to access precise user location in mapbox v10

Viewed 262

I am trying to ease the camera to the users location. However, using

        let cameraOnUser = mapView.mapboxMap.camera(for: 
        mapView.location.latestLocation?.coordinate, padding: .zero, bearing: nil, pitch: nil)
    mapView.camera.ease(to: cameraOnUser, duration: 10.0)

does not work, because mapView.location.latestLocation.coordinate is a radiant coordinate, not an exact CLLocationCorrdinate2D. Looking into the API Reference, Location.corrdinate should give me the coordinates I need, but XCode does not let me use that call in that context. Calculating a route works fine with latestLocation.corrdinate but not the camera ease to. How do I access the user's location in the new mapbox versions? Or: Is there a way to use something like mapView.setUserTrackingMode(.follow, animates: true) like we could in v6.3.0? Thanks! I am using mapboxMaps v10.0.1.

0 Answers
Related