Closed makinggainz closed 5 years ago
ClusterKit works with MKAnnotation
but this is easily fixed by adding the compliance. MGLAnnotation
and MKAnnotation
are very close:
class YourAnnotation: NSObject, MGLAnnotation, MKAnnotation {
...
}
@maxep I currently do not have my own custom class for my annotations. I must then create one? What content should it have inside? Could you point me to any examples of how this would be implemented?
MGLAnnotation
like MKAnnotation
are protocols, so you need to create a concrete type that complies to MKAnnotation
to be used as an annotation in ClusterKit.
In the examples of this project, I use the MKPointAnnotation
.
@maxep So I did this and also implemented the other pieces of functionality and it has not been working. I find that in the
func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {
method I get nil when doing:
if let cluster = annotation as? CKCluster, cluster.count > 1 {
How do I fix this? I also asked a SO question if you would like to check it out.
I also did extension MapVC: MGLMapViewDelegate, MKMapViewDelegate {
But that does not seem to help. Not sure if I need to do this or not.
I believe my problem above has to do with the clustering not working at all so I opened a new issue for it. https://github.com/hulab/ClusterKit/issues/68
So I am trying to implement the mapbox pods in order to cluster a bunch of customPointAnnotations which are in an array. The only problem is that on the line below:
mapView1.clusterManager.annotations = annotations
I get the following error:Does clusterkit not work with MGLAnnotations?