3

I’m using iOS 11 clustering and it works really fine, basically you just need to ad an identifier to the clusteringIdentifier property of an MKAnnotationView.
Everything works perfectly but I have an issue, when a user select a marker from a map I'd like to avoid clustering at least on the selected maker.
The mapView doesn't seems to have a property to disable clustering. The only plausible solution is to nil clusteringIdentifier, but even if I do that it keeps to cluster.

func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {  
         view.clusteringIdentifier = nil  
    }  

Can someone post me in the right direction?

Andrea
  • 26,120
  • 10
  • 85
  • 131

1 Answers1

2

Give the clusteringIdentifier a unique value. If the clusteringIdentifier has a value that is not shared with any other annotation views, it won't cluster with any other annotation views.

You can obtain a unique value by saying UUID().uuidString.

Matjan
  • 3,591
  • 1
  • 33
  • 31
matt
  • 515,959
  • 87
  • 875
  • 1,141