title: Custom MKMarkerAnnotationView Like Photos App
body: <p>I am attempting to do a custom pinView like how the Photos app does it like so:
  <a href="https://i.stack.imgur.com/o7PLQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/o7PLQ.png" alt="enter image description here"></a></p>
  
  <p>So far, most resources I can find on SO or <a href="http://sweettutos.com/2016/01/21/swift-mapkit-tutorial-series-how-to-customize-the-map-annotations-callout-request-a-transit-eta-and-launch-the-transit-directions-to-your-destination/" rel="noreferrer">here</a> and <a href="https://www.raywenderlich.com/160517/mapkit-tutorial-getting-started" rel="noreferrer">here</a> show ways to customise the image of the pin or the callout views, but none on a customised view of the marker itself.</p>
  
  <p>Eventually, what I wanna achieve is similar to the Photos app, where each image displayed on the marker itself is a profileImage of the user, but a rounded view. My code so far is very basic:</p>
  
  <pre><code>func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -&gt; MKAnnotationView? {
          var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "pin") as? MKMarkerAnnotationView
  
          if annotationView == nil {
              annotationView = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: "pin")
              annotationView?.canShowCallout = true
              annotationView?.leftCalloutAccessoryView = UIImageView(image: UIImage(named: "profileImage"))
          } else {
              annotationView?.annotation = annotation
          }
  
          return annotationView
      }
  </code></pre>
  
  <p>I hope this post do not get down voted as I've really exhausted my search online for resources. It would be great if someone could point me out in the right direction pls, thanks.</p>