The Maps SDK for iOS repository on
GitHub
contains samples illustrating the use of the Maps SDK for iOS
in your iOS app. The sample app contains code for feature highlights of the SDK,
and can be used starting point for your app.
Maps SDK for iOS samples list
Key sample activities from the demo app are listed below and reproduced at the
linked pages for quick reference. See the GitHub samples
folder
for the full list of available samples.
The Maps SDK for iOS sample app is available as a
download archive
from GitHub.
Follow these steps to install and try the Maps SDK for iOS sample app.
Run git clone https://github.com/googlemaps-samples/maps-sdk-for-ios-samples.git
to clone the samples repository into a local directory.
Open a terminal window, navigate to the directory where you cloned the sample files, and
drill down into the GoogleMaps directory:
Swift
cd maps-sdk-for-ios-samples-main/GoogleMaps-Swift
pod installopen GoogleMapsSwiftDemos.xcworkspace
Objective-C
cd maps-sdk-for-ios-samples-main/GoogleMaps
pod installopen GoogleMapsDemos.xcworkspace
In Xcode, press the compile button to
build the app
with the current scheme. The build produces an error, prompting you to enter your API key
in the SDKConstants.swift file for Swift orSDKDemoAPIKey.h
file for Objective-C.
Edit the SDKConstants.swift file for Swift orSDKDemoAPIKey.h
file for Objective-C and paste your API key into the definition of either the
apiKey or kAPIKey constant. For example:
Swift
staticletapiKey="YOUR_API_KEY"
Objective-C
staticNSString*constkAPIKey=@"YOUR_API_KEY";
In the SDKConstants.swift file (Swift) orSDKDemoAPIKey.h
file (Objective-C), remove the following line, because it's used to register the user-defined issue:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-18 UTC."],[[["\u003cp\u003eThe Maps SDK for iOS provides a sample app with code examples showcasing key features, serving as a starting point for your iOS app development.\u003c/p\u003e\n"],["\u003cp\u003eYou can find a comprehensive list of samples in the GitHub repository and easily access specific feature implementations through provided links.\u003c/p\u003e\n"],["\u003cp\u003eTo run the full sample app locally, clone the repository, install dependencies using CocoaPods, and build the project in Xcode after configuring your API key.\u003c/p\u003e\n"],["\u003cp\u003eTroubleshooting steps are available if you encounter issues like not seeing a map after successfully running the app, guiding you to add your API key correctly.\u003c/p\u003e\n"]]],["The provided content focuses on using the Maps SDK for iOS. Key actions include cloning the sample app repository from GitHub, building the app in Xcode, and integrating an API key. The API key is obtained from the Google Cloud console. After entering the API key, you can build and run the project. You then can interact with the various features demonstrated, like displaying a basic map, adding markers, drawing shapes, enabling location, and handling events. Finally, the content mentions the necessity to grant the app location access.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/examples \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/examples \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/examples \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nThe Maps SDK for iOS repository on\n[GitHub](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps)\ncontains samples illustrating the use of the Maps SDK for iOS\nin your iOS app. The sample app contains code for feature highlights of the SDK,\nand can be used starting point for your app.\n| **Troubleshooting:** If the sample app runs successfully but you don't see a map, check that you've added your API key to the app's manifest file, as described in [Using API Keys](/maps/documentation/ios-sdk/get-api-key).\n\nMaps SDK for iOS samples list\n\nKey sample activities from the demo app are listed below and reproduced at the\nlinked pages for quick reference. See the GitHub [samples\nfolder](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps/GoogleMapsDemos/Samples)\nfor the full list of available samples.\n\n- [Display a basic map](/maps/documentation/ios-sdk/examples/basic-map)\n- [Display an info window for a marker](/maps/documentation/ios-sdk/examples/info-window-marker)\n- [Add a marker to a map](/maps/documentation/ios-sdk/examples/add-marker)\n- [Reverse geocode a location](/maps/documentation/ios-sdk/examples/reverse-geocode)\n- [Enable and disable map gestures](/maps/documentation/ios-sdk/examples/enable-disable-gestures)\n- [Handle marker events](/maps/documentation/ios-sdk/examples/handle-marker-events)\n- [Enable the My Location Button](/maps/documentation/ios-sdk/examples/enable-my-location)\n- [Draw polygons on a map](/maps/documentation/ios-sdk/examples/draw-polygons)\n- [Draw polylines on a map](/maps/documentation/ios-sdk/examples/draw-polylines)\n\nRun the full sample app locally\n\nThe Maps SDK for iOS sample app is available as a\n[download archive](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/archive/main.zip)\nfrom [GitHub](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps).\nFollow these steps to install and try the Maps SDK for iOS sample app.\n\n1. Run `git clone https://github.com/googlemaps-samples/maps-sdk-for-ios-samples.git` to clone the samples repository into a local directory.\n2. Open a terminal window, navigate to the directory where you cloned the sample files, and\n drill down into the GoogleMaps directory:\n\n Swift \n\n cd maps-sdk-for-ios-samples-main/GoogleMaps-Swift\n pod install\n open GoogleMapsSwiftDemos.xcworkspace\n\n Objective-C \n\n cd maps-sdk-for-ios-samples-main/GoogleMaps\n pod install\n open GoogleMapsDemos.xcworkspace\n\n3. In Xcode, press the compile button to [build the app](https://developer.apple.com/documentation/xcode/building-and-running-an-app) with the current scheme. The build produces an error, prompting you to enter your API key in the `SDKConstants.swift` file for Swift or`SDKDemoAPIKey.h` file for Objective-C.\n4. [Get an API key](/maps/documentation/ios-sdk/get-api-key) from your project with the [Maps SDK for iOS enabled](/maps/documentation/ios-sdk/cloud-setup#enabling-apis).\n5. Edit the `SDKConstants.swift` file for Swift or`SDKDemoAPIKey.h` file for Objective-C and paste your API key into the definition of either the `apiKey` or `kAPIKey` constant. For example: \n\n Swift \n\n ```swift\n static let apiKey = \"YOUR_API_KEY\"\n ```\n\n Objective-C \n\n ```objective-c\n static NSString *const kAPIKey = @\"YOUR_API_KEY\";\n ```\n6. In the `SDKConstants.swift` file (Swift) or`SDKDemoAPIKey.h` file (Objective-C), remove the following line, because it's used to register the user-defined issue: \n\n Swift \n\n ```swift\n #error (Register for API Key and insert here. Then delete this line.)\n ```\n\n Objective-C \n\n ```objective-c\n #error Register for API Key and insert here.\n ```\n7. Build and run the project. The iOS simulator window appears, showing a list of **Maps SDK Demos**.\n8. Choose one of the options displayed, to experiment with a feature of the Maps SDK for iOS.\n9. If prompted to allow GoogleMapsDemos to access your location, choose **Allow**."]]