Skip to content

Instantly share code, notes, and snippets.

func updateLocationOnMap(to location: CLLocation, with title: String?) {
let point = MKPointAnnotation()
point.title = title
point.coordinate = location.coordinate
self.mapView.removeAnnotations(self.mapView.annotations)
self.mapView.addAnnotation(point)
let viewRegion = MKCoordinateRegion(center: location.coordinate, latitudinalMeters: 200, longitudinalMeters: 200)
self.mapView.setRegion(viewRegion, animated: true)