I am using GMUClusterItem in my google map to load items.
I can load the items using the below code (its a sample)
let item = POIItem(position: CLLocationCoordinate2DMake(38.6646184, -120.9465773, name: "")
clusterManager.add(item)
It works fine
But my problem is to remove a particular item.
I tried the below code
let item = POIItem(position: CLLocationCoordinate2DMake(38.6646184, -120.9465773), name: "")
clusterManager.remove(item)
But its not working
Is there mistake in that? If so, please help me to remove particular item.
Thanks
Your code clusterManager.remove(item)
does remove the marker from the map, but did you refresh the map? You need to call clusterManager.cluster()
again to update the map rendering.
DispatchQueue.main.async {
self.clusterManager.cluster()
}
(Using Swift 3)