// MARK: - MapView Delegate
override func mapView(_ mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
var anView = mapView.dequeueReusableAnnotationView(withIdentifier: annotationReuseId)
if anView == nil {
anView = MKAnnotationView(annotation: annotation, reuseIdentifier: annotationReuseId)
} else {
anView!.annotation = annotation
}
anView!.image = UIImage(named: "Contactus_gatePin")
anView?.frame = CGRect(x: 0, y: 0, width: 53, height: 53)
anView!.backgroundColor = UIColor.clear
anView!.canShowCallout = false
return anView
}
override func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
return
}
I am getting error for this method in Swift3. It was working in Swift2.2
i couldn't convert this to Swift 3.0
Please help
In Swift 3 viewForAnnotation
method of MKMapViewDelegate
is changed like this.
optional func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
}
Fore other methods check Apple Documentation on MKMapViewDelegate
.