title: Multiple Custom Point Annotations - Swift
body: <p>I am trying to give my two MKPointAnnotation pins a custom image. So far I am being able to display the same image on both pins. What could I do to the code below to give each pin a custom image?</p>
  
  <pre><code>func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -&gt; MKAnnotationView? {
  
          guard !(annotation is MKUserLocation) else {
              return nil
          }
  
  
          let annotationIdentifier = "AnnotationIdentifier"
  
          var annotationView: MKAnnotationView?
  
          if let dequeuedAnnotationView = mapView.dequeueReusableAnnotationView(withIdentifier: annotationIdentifier) {
              annotationView = dequeuedAnnotationView
              annotationView?.annotation = annotation
          }
          else {
              annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: annotationIdentifier)
              annotationView?.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
          }
  
  
          if let annotationView = annotationView {
              annotationView.canShowCallout = true
              annotationView.image = UIImage(named: "Moto_pin")
          }
  
          return annotationView
      }
  </code></pre>