We are using the Map functionality with annotations.
Functionality:- We have 2000 records in the array but we need to filter 150 records according to the region changed in the Map in SwiftUI. But there is no scroll end event of the Map in SwiftUI.
We used the below code
Map(coordinateRegion: self.$viewModel.region, interactionModes: [.all], annotationItems: self.viewModel.mapLocations), annotationContent: { pin in
}
We got the latest updated region in .onChange(of: viewModel.region) }. But we did not get the map scroll end event. We put the code in onChange(of) but it's lagging while scrolling. So, It's not worked for us.
Also. We tried Drag-Gesture but won't worked.
.gesture(DragGesture()
.onEnded { value in
//Did not getting this event while map scroll end
})