I am using navigation view for my application, I wan to load n number markers on navigation view with different marker images. When I tried to do this with navigation annotation view only destination image is changed others shown as 1,2,3 etc. I tried to load image using this function
func navigationMapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
let reuseIdentifier = "\(annotation.coordinate)"
let annotationView1 = MGLAnnotationView(reuseIdentifier: reuseIdentifier)
if let castAnnotation = annotation as? CustomPointAnnotation {
annotationView1.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
let imageV = UIImageView(frame: (annotationView1.frame))
imageV.contentMode = .center
imageV.image = UIImage(named: castAnnotation.image!)
annotationView1.addSubview(imageV)
}
return annotationView1