title: how to change default image in MKUserLocation annotation in Swift iOS
body: <p>I have a map view in my app that displays the user's location. when the user's location is tapped an image is displayed as below:</p>
  <p><a href="https://i.stack.imgur.com/b687P.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b687P.jpg" alt="enter image description here" /></a></p>
  <p>is there a way to make this image customized to my liking, so for instance I would like to show the photo that the user has in his own profile, or any other static image that I would like to add.</p>
  <p>similar to how the apple maps would show your profile picture in your location dot.</p>
  <p>how can I do that here?</p>
  <p>here is my code:</p>
  <pre><code> func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -&gt; MKAnnotationView? {
         if annotation is MKUserLocation {
          print(&quot;user location image tapped&quot;)
          
             return nil
         }
  
         let reuseId = &quot;pin&quot;
         var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId) as? MKPinAnnotationView
         if pinView == nil {
             pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
             pinView?.animatesDrop = true
             pinView?.canShowCallout = true
             pinView?.isDraggable = true
          
           //  pinView?.pinColor = .purple
  
             let rightButton: AnyObject! = UIButton(type: UIButton.ButtonType.detailDisclosure)
             pinView?.rightCalloutAccessoryView = rightButton as? UIView
     
         }
         else {
             pinView?.annotation = annotation
         }
         
         return pinView
     }
  </code></pre>
  <p>any help on this? thank you.</p>