How to change the size of a mapView annotation swift

54 Views Asked by At

Ok so I've searched around for an answer and nothing I've found seems to work. I'm trying to iterate through the map annotations and highlight the target annotation by increasing it's size, increasing the border size and changing the border color. What I'm I doing wrong:

for annotation in self.mapView.annotations {

  guard let currentAnnotationID = annotation.subtitle ?? "" else {return}

  if currentAnnotation == targetAnnotationID {
    var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: targetAnnotationID)
    annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: targetAnnotationID)
    let annotationSize = CGSize(width: 50, height: 50)
    annotationView!.frame = CGRect(origin: .zero, size: annotationSize)
    annotationView!.layer.borderColor = .red
    annotationView!.layer.borderWidth = 2.0
  }

}

0

There are 0 best solutions below