From bd2d7953202dc0fbbe19313df265eb2a6e43d7d0 Mon Sep 17 00:00:00 2001 From: Andre Destro Date: Tue, 6 Oct 2026 10:39:58 +0100 Subject: [PATCH] chore(ios): replace deprecated GMSMapView initializers Use GMSMapView(options:) with GMSMapViewOptions instead of init(frame:camera:) and init(frame:mapID:camera:), which are deprecated. GMSMapViewOptions is available in Maps SDK 9.4 (CocoaPods) and 10.x (SPM), so a single code path covers both. --- plugin/ios/Sources/CapacitorGoogleMapsPlugin/Map.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin/ios/Sources/CapacitorGoogleMapsPlugin/Map.swift b/plugin/ios/Sources/CapacitorGoogleMapsPlugin/Map.swift index 85a8953d..0e006313 100644 --- a/plugin/ios/Sources/CapacitorGoogleMapsPlugin/Map.swift +++ b/plugin/ios/Sources/CapacitorGoogleMapsPlugin/Map.swift @@ -27,12 +27,13 @@ class GMViewController: UIViewController { let camera = GMSCameraPosition.camera(withLatitude: cameraPosition["latitude"] ?? 0, longitude: cameraPosition["longitude"] ?? 0, zoom: Float(cameraPosition["zoom"] ?? 12)) let frame = CGRect(x: mapViewBounds["x"] ?? 0, y: mapViewBounds["y"] ?? 0, width: mapViewBounds["width"] ?? 0, height: mapViewBounds["height"] ?? 0) + let options = GMSMapViewOptions() + options.frame = frame + options.camera = camera if let id = mapId { - let gmsId = GMSMapID(identifier: id) - self.GMapView = GMSMapView(frame: frame, mapID: gmsId, camera: camera) - } else { - self.GMapView = GMSMapView(frame: frame, camera: camera) + options.mapID = GMSMapID(identifier: id) } + self.GMapView = GMSMapView(options: options) self.view = GMapView self.onViewDidLoad?()