'How do you cluster annotations with v10 of the MapBox iOS SDK?

How is clustering done with v10 of the Mapbox iOS SDK? And can I use ViewAnnotations to show custom views for clusters?

In short, I am trying to cluster annotations on a Mapbox MapView, and show a custom UIView at each cluster. Something like the example shown here in the Mapbox documentation for v6.x.

enter image description here

After looking through the iOS SDK guides and the documentation, it's unclear how to do this. There's even a section called "Migrate to v10", which seems to cover all the differences between v6.x and v10, except for how to cluster data. Before v10 of Mapbox (with v6.x), it seems you would use MGLPointFeatureCluster, but I can't find anything covering clustering with v10.

Thanks in advance!



Solution 1:[1]

Apparently, this feature is now built-in. I added a variety of annotations in different locations and it automatically grouped them into clusters when zooming in/out. No custom code is needed :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sammcode