I have added clustering with annotations in my project and it's working fine but having problem to set the limit.
Please check below image here, grouping is done for 6 annotations but I want to set clustering limit which should start grouping at 20 (So never see one of these with the number 19 or lower)
func mapView(_ mapView: MKMapView, clusterAnnotationForMemberAnnotations memberAnnotations: [MKAnnotation]) -> MKClusterAnnotation {
return MKClusterAnnotation(memberAnnotations: memberAnnotations)
}
Also I tried this but not working for me.
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let groupedpin = annotation as! MKClusterAnnotation
if groupedpin.memberAnnotations.count >= 20 { //<— Not working
let view = PlaceClusterAnnotationView.annotationView()
view._count = groupedpin.memberAnnotations.count.description
return view
}
return MKAnnotationView()
}