Can't reach unique pins
Closed this issue · 4 comments
kristiyandobrev commented
Consider that I am having the following code:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if let annotationABF = annotation as? ABFAnnotation {
if annotationABF.type == .unique {
......
//more code
I am trying to get to the unique pins, but it seems like the I can never reach inside the if annotationABF.type == .unique
. Quite strange because annotationABF.type
of all the objects on the map seems to return .cluster
.
A workaround that I found was having:
if annotationABF.safeObjects.count == 1 {
guard let object = annotationABF.safeObjects.first?.rlmObject() as? MyObject else {
return nil
}
}
So Any ideas of why am I not getting to the unique pins using annotationABF.type == .unique
?
ajandrade commented
@kristiyandobrev Any update on this? Like you said, every annotation is considered as .cluster.
kristiyandobrev commented
Well, still haven't got any different solution then the workaround I show.
bigfish24 commented
ah! that's a small bug, where it should check to see if the cluster is 1 and set to unique. I will fix, thanks for reporting!
bigfish24 commented
Fixed in v2.1.2:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if let annotationABF = annotation as? Annotation {
if annotationABF.type == .unique {
// ...
}
}
// ...
}