In my Map Application I am showing almost 1500 area in city using GMUClusterManager
.
I am calling API and set GSMarker and calling function in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: {
})
in API process start with UIActivityIndicatorView
Show so user can't touch on screen.
After the certain level of zoom I am showing Plot of this area it around 300 to 400.
when plot set using for loop it freeze UI for 3-4 seconds.code is below.
for i in self.plotPolygon {
DispatchQueue.main.async {
i.map = self.mapView
}
}
for i in self.plotMarkers {
DispatchQueue.main.async {
i.map = self.mapView
}
}
Plot is getting through API Calling with DispatchQueue
and set with GMSMarker
and GMSPolygon
. photo is given below.
after certain zoom out on plot is remove from Google map.
here problem is that every time zoom in process plot API call and in zoom out remove from map and every time UIActivityIndicatorView
show.
so my question is given below.
How can I call API and set data without freezes UI and set on Google Map ?