Skip to content

Conversation

@noahlit
Copy link

@noahlit noahlit commented Oct 20, 2025

Currently if using SwiftUI map, we need to pass MKCoordinateRegion into the ClusterManager when reloading the clusters/annotations. However, I found this causes all clusters and map annotations to disappear when zoomed all the way out.

This PR adds a function to ClusterManager so we can reload with an existing MKMapRect instance rather than having the library convert MKMapCoordinateRegion into MKMapRect.

Old (From README):

Map()
.onMapCameraChange(frequency: .onEnd) { context in
  Task.detached { await clusterManager.reload(mapViewSize: mapSize, coordinateRegion: context.region) }
}

New:

Map()
.onMapCameraChange(frequency: .onEnd) { context in
  Task.detached { await clusterManager.reload(mapViewSize: mapSize, mapRect: context.rect) }
}

Fixes: #5

@noahlit noahlit closed this Oct 20, 2025
@noahlit noahlit reopened this Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update fails sometimes after map swipe

1 participant