Как добавить одну аннотацию карты:
let annotation = MKPointAnnotation()
annotation.coordinate = CLLocationCoordinate2D(latitude: 10.0, longitude: 59.0)
annotation.title = "Pizza Place"
annotation.subtitle = "Phone: 0012345678"
map.addAnnotation(annotation)
Функция добавления нескольких аннотаций Pizza Place:
func addPizzaPlacesToMap(places: [PizzaPlace]) {
// Remove all annotations from map
self.map.removeAnnotations(self.map.annotations)
// Loop trough all your pizza places and add them to the map
for place in places {
let annotation = MKPointAnnotation()
annotation.title = place.name
annotation.subtitle = place.phone
annotation.coordinate = place.coordinate
self.map.addAnnotation(anno)
}
}