I have added this:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
return nil
}
let pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "id")
if let title = annotation.title{
if title! == "P"{
pinView.pinTintColor = UIColor.yellow
}
else{
pinView.pinTintColor = UIColor.gray
}
}
return pinView
}
But when I do this I can´t see my titles when I click on an annotation anymore, any ideas why?