To display clusters on the map, you must implement the mapView(_:viewFor:) delegate method. When the annotation is a ClusterAnnotation, return an instance of ClusterAnnotationView (or a subclass).
For standard pins, return a regular MKAnnotationView (like MKPinAnnotationView).
extension ViewController: MKMapViewDelegate {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if let annotation = annotation as? ClusterAnnotation {
return CountClusterAnnotationView(annotation: annotation, reuseIdentifier: "cluster")
} else {
return MKPinAnnotationView(annotation: annotation, reuseIdentifier: "pin")
}
}
}