Closed sebleclerc closed 5 years ago
I am having this same issue.
edit I am reverting back to 2.2.8 till update on this issue.
Sorry for the confusion. I've deprecated the ClusterAnnotationStyle
and instead added new ClusterAnnotationView
subclasses. You can now achieve the same UI using:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let annotationView = CountClusterAnnotationView(annotation: annotation, reuseIdentifier: reuseIdentifier)
annotationView.countLabel.backgroundColor = color
return annotationView
}
https://github.com/efremidze/Cluster/blob/master/Example/AnnotationView.swift
Feel free to provide feedback on the implementation.
@sebleclerc @guapokat I've reintroduced the ClusterAnnotationStyle
but you need to use the StyledClusterAnnotationView
to support it. It's out in v2.4.3.
@efremidze Thanks for the quick changes!
My original question was also about "regular" pin. What I did was to subclass Annotation
and use that style property. After getting into the code again, I see what my problem was. I'll have to change that a bit to make sure I'm 100% good with the upcoming 2.5.0 release that will remove the style
property.
I can continue supporting the style
property but it's error prone since the library doesn't consider the style
property when grouping clusters. It currently just checks the first element in the cluster and uses it's style
. I need to come up with a better solution to support multiple styles.
My mind is more clear on what it involves removing the style
property. I don't really care if it's removed, you probably know better than me if it could cause problem 😃
I used the style
for the regular pins to store their color because different colors have different meaning in my app. I have removed the use of style
for these.
As you mentioned, cluster view use the first element style, which is not something I want. I want to have all cluster views with the same color. If that would be possible when removing the style
property, I'm totally fine.
In your case it wouldn't cause a problem.
Good to hear! Thanks a lot for the quick answer and changes.
I upgraded from Cluster 2.2.8 to latest 2.4.1. After the upgrade, I had some errors stating that ClusterAnnotationStyle does not exists anymore.
New Issue Checklist
Issue Description
How am I suppose to style my pins on the map now? I read a little bit and saw the style property have been made private but that's pretty much it.
In the doc I see this:
But the style property doesn't exists anymore.
I am clearly missing something here but can't find it...
Thanks!
Environment