Home > Enterprise >  Why GMUClusterManager is not showing on iOS?
Why GMUClusterManager is not showing on iOS?

Time:03-27

I try to use SwiftUI view using the UIViewRepresentable pattern, the GoogleMaps background works but the ClusterManager doesn't show anything. Is there something wrong?

I try to generate 10000 markers like in the sample of enter image description here

CodePudding user response:

You are creating clusterManager inside updateUIView but not saving it anywhere, so it’s immediately discarded. In the Google sample code, they save clusterManager as a property of the view controller; you don’t have a view controller, so I’d recommend moving clusterManager and related code into your MapCoordinator class. Coordinators are kept around for the lifetime of your view and can be accessed from makeUIView and updateUIView using context.coordinator.

  • Related