Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1274,13 +1274,6 @@ Supports markers of either either "legacy" or "advanced" types.
<code>google.maps.<a href="#marker">Marker</a> | google.maps.marker.AdvancedMarkerElement</code>


#### Marker

Supports markers of either either "legacy" or "advanced" types.

<code>google.maps.<a href="#marker">Marker</a> | google.maps.marker.AdvancedMarkerElement</code>


### Enums


Expand Down
21 changes: 15 additions & 6 deletions plugin/ios/Plugin/Map.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class GMViewController: UIViewController {
var cameraPosition: [String: Double]!
var minimumClusterSize: Int?
var mapId: String?
var onViewDidLoad: (() -> Void)?

private var clusterManager: GMUClusterManager?

Expand All @@ -34,6 +35,7 @@ class GMViewController: UIViewController {
}

self.view = GMapView
self.onViewDidLoad?()
}

func initClusterManager(_ minClusterSize: Int?) {
Expand Down Expand Up @@ -94,10 +96,12 @@ public class Map {
self.delegate = delegate
self.mapViewController = GMViewController()
self.mapViewController.mapId = config.mapId

self.mapViewController.onViewDidLoad = { [weak self] in
self?.finishMapConfiguration()
}
self.render()
}

func render() {
DispatchQueue.main.async {
self.mapViewController.mapViewBounds = [
Expand All @@ -106,23 +110,28 @@ public class Map {
"x": self.config.x,
"y": self.config.y
]

self.mapViewController.cameraPosition = [
"latitude": self.config.center.lat,
"longitude": self.config.center.lng,
"zoom": self.config.zoom
]

self.targetViewController = self.getTargetContainer(refWidth: self.config.width, refHeight: self.config.height)

if let target = self.targetViewController {
target.tag = Map.MAP_TAG
target.removeAllSubview()
self.mapViewController.view.frame = target.bounds
target.addSubview(self.mapViewController.view)
self.mapViewController.GMapView.delegate = self.delegate
}
}
}

func finishMapConfiguration() {
DispatchQueue.main.async {
self.mapViewController.GMapView.delegate = self.delegate

if let styles = self.config.styles {
do {
self.mapViewController.GMapView.mapStyle = try GMSMapStyle(jsonString: styles)
Expand Down
Loading