After displaying a map, the user can pan, zoom, change the heading, and change the pitch (for a 3D view). I want to let the user save those details so I can restore that view of the map later. I save all the data I think I need in an “attraction” object. Below is the code I use to restore the view. It gets close to the original map state, but it’s off by a bit. What could I be missing?
let center = CLLocationCoordinate2D( latitude: attraction.latitude, longitude: attraction.longitude ) let region = MKCoordinateRegion( center: center, latitudinalMeters: attraction.latitudeDelta, longitudinalMeters: attraction.longitudeDelta ) mapView.setRegion(region, animated: true) mapView.camera.heading = attraction.heading mapView.camera.pitch = attraction.pitch