Skip to content

Commit

Permalink
Correctly register cluster annotation views
Browse files Browse the repository at this point in the history
  • Loading branch information
pauljohanneskraft committed Mar 1, 2023
1 parent 2e569f8 commit 3eed43c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Sources/Map/Map+Coordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,18 @@ extension Map {
if let content = annotationContentByObject[ObjectIdentifier(annotation)] {
return content.view(for: mapView)
} else if let clusterAnnotation = annotation as? MKClusterAnnotation {
let content = clusterAnnotation.memberAnnotations.compactMap { annotation -> AnnotationItems.Element? in
let members = clusterAnnotation.memberAnnotations.compactMap { annotation -> AnnotationItems.Element? in
guard let item = annotationItemByObject[ObjectIdentifier(annotation)] else {
assertionFailure("Somehow a cluster contains an unknown annotation item.")
return nil
}
return item
}
return view?
.clusterAnnotation(clusterAnnotation, content)?
.view(for: mapView)
guard let content = view?.clusterAnnotation(clusterAnnotation, members) else {
return nil
}
registerAnnotationViewIfNeeded(on: mapView, for: content)
return content.view(for: mapView)
} else {
return nil
}
Expand Down

0 comments on commit 3eed43c

Please sign in to comment.