bigfish24/ABFRealmMapView

Can't reach unique pins

Closed this issue · 4 comments

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 ?

@kristiyandobrev Any update on this? Like you said, every annotation is considered as .cluster.

Well, still haven't got any different solution then the workaround I show.

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!

Fixed in v2.1.2:

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
    if let annotationABF = annotation as? Annotation {
        if annotationABF.type == .unique {
            // ...
        }
    }
    // ... 
}