Docs / Setup / iOS / Google Maps

Google Maps setup

How to drive the Google Maps SDK for iOS through MapConductor. Pick this provider when your app already depends on Google Maps, or when you need the map types on GoogleMapDesign.

PACKAGE
ios-for-googlemaps
API KEY
Required
MIN iOS
16.0
VIEW
GoogleMapView
Same provider, other platformsAndroidReact

Before you start

Xcode 15 or newer
A Google Cloud Console account
A Google Cloud project with Maps SDK for iOS enabled
A deployment target of iOS 16.0 or later
STEP 01

Get an API key

  1. Open the Google Cloud Console.
  2. Create a project or select an existing one.
  3. Enable the Maps SDK for iOS API.
  4. Create an API key under Credentials.
  5. Restrict the key to your app's bundle ID.
STEP 02

Add it with Swift Package Manager

Use File > Add Package Dependencies in Xcode and paste the package URL. The native SDK comes in as a transitive dependency — you do not add it separately.

Package URLSwift Package Manager
https://github.com/MapConductor/ios-for-googlemaps
Package.swiftSwift
dependencies: [
    .package(url: "https://github.com/MapConductor/ios-sdk-core", from: "1.1.4"),
    .package(url: "https://github.com/MapConductor/ios-for-googlemaps", from: "1.0.0"),
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "MapConductorCore", package: "ios-sdk-core"),
            .product(name: "MapConductorForGoogleMaps", package: "ios-for-googlemaps"),
        ]
    ),
]
STEP 03

Initialise the SDK

Call GMSServices.provideAPIKey(_:) exactly once, before any map view is created. The @main App struct is the recommended place.

MyApp.swiftSwift
import SwiftUI
import GoogleMaps
import MapConductorForGoogleMaps

@main
struct MyApp: App {
    init() {
        GMSServices.provideAPIKey("YOUR_GOOGLE_MAPS_API_KEY")
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
ContentView.swiftSwift
// Alternative: call it from the view's sdkInitialize closure
GoogleMapView(state: mapState, sdkInitialize: {
    GMSServices.provideAPIKey("YOUR_GOOGLE_MAPS_API_KEY")
})
CAUTION
Do not hard-code the API key in source. Inject it at build time from an xcconfig or environment variable and keep it out of the repository.
STEP 04

Add the location permission (if needed)

If you use location services with Google Maps, declare the purpose in Info.plist and request permission from the app.

Info.plistXML
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to display on the map</string>
LocationManager.swiftSwift
import CoreLocation

final class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {
    private let manager = CLLocationManager()

    override init() {
        super.init()
        manager.delegate = self
    }

    func requestPermission() {
        manager.requestWhenInUseAuthorization()
    }
}

VERIFY

What you should see

Build and run this ContentView. If the map renders and zoom and pan work, you are done.

ContentView.swiftSwiftUI
import SwiftUI
import MapConductorCore
import MapConductorForGoogleMaps

struct ContentView: View {
    @StateObject var mapState = GoogleMapViewState(
        cameraPosition: MapCameraPosition(
            position: GeoPoint(latitude: 35.6762, longitude: 139.6503),
            zoom: 12.0
        )
    )

    var body: some View {
        GoogleMapView(state: mapState)
            .ignoresSafeArea()
    }
}

Map designs

GoogleMapDesign maps onto Google's map types.

GoogleMapDesign
Notes
Normal
The standard road map
Satellite
Satellite imagery
Hybrid
Satellite imagery with roads and labels
Terrain
Terrain map

Troubleshooting

The map does not appear (grey screen)

  • Confirm GMSServices.provideAPIKey(_:) runs before any map view is created.
  • Check Maps SDK for iOS is enabled in the Console.
  • Verify the key's bundle ID restriction matches your actual bundle ID.
  • Check the deployment target is iOS 16.0 or later.

The build fails

  • Clean the build folder (Cmd+Shift+K).
  • Delete ~/Library/Developer/Xcode/DerivedData and rebuild.
  • Refresh the Swift Package Manager dependencies, and avoid mixing in CocoaPods.

Next

Once GoogleMapView renders, markers, polylines and circles use the shared API — swapping providers does not rewrite them.