Select platform: [Android](https://developers.google.com/maps/documentation/android-sdk/examples.md.txt "View this page for the Android platform docs.") [iOS](https://developers.google.com/maps/documentation/ios-sdk/examples.md.txt "View this page for the iOS platform docs.") [JavaScript](https://developers.google.com/maps/documentation/javascript/examples.md.txt "View this page for the JavaScript platform docs.")

<br />

The Maps SDK for iOS repository on
[GitHub](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps)
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.

> [!NOTE]
> **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](https://developers.google.com/maps/documentation/ios-sdk/get-api-key.md.txt).

## 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](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps/GoogleMapsDemos/Samples)
for the full list of available samples.

- [Display a basic map](https://developers.google.com/maps/documentation/ios-sdk/examples/basic-map.md.txt)
- [Display an info window for a marker](https://developers.google.com/maps/documentation/ios-sdk/examples/info-window-marker.md.txt)
- [Add a marker to a map](https://developers.google.com/maps/documentation/ios-sdk/examples/add-marker.md.txt)
- [Reverse geocode a location](https://developers.google.com/maps/documentation/ios-sdk/examples/reverse-geocode.md.txt)
- [Enable and disable map gestures](https://developers.google.com/maps/documentation/ios-sdk/examples/enable-disable-gestures.md.txt)
- [Handle marker events](https://developers.google.com/maps/documentation/ios-sdk/examples/handle-marker-events.md.txt)
- [Enable the My Location Button](https://developers.google.com/maps/documentation/ios-sdk/examples/enable-my-location.md.txt)
- [Draw polygons on a map](https://developers.google.com/maps/documentation/ios-sdk/examples/draw-polygons.md.txt)
- [Draw polylines on a map](https://developers.google.com/maps/documentation/ios-sdk/examples/draw-polylines.md.txt)

## Run the full sample app locally

The Maps SDK for iOS sample app is available as a
[download archive](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/archive/main.zip)
from [GitHub](https://github.com/googlemaps-samples/maps-sdk-for-ios-samples/tree/main/GoogleMaps).
Follow these steps to install and try the Maps SDK for iOS sample app.

> [!IMPORTANT]
> **Important:** You must remove any existing dependencies added using CocoaPods or manually. See [Step 2 of Set up an Xcode project](https://developers.google.com/maps/documentation/ios-sdk/config.md.txt#swift-package-manager) for instructions.

1. Run `git clone https://github.com/googlemaps-samples/maps-sdk-for-ios-samples.git` to clone the samples repository into a local directory.
2. 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/GoogleMaps-Swift
       open GoogleMapsSwiftXCFrameworkDemos.xcodeproj

   ### Objective-C

       cd maps-sdk-for-ios-samples-main/GoogleMaps
       open GoogleMapsDemos.xcodeproj

3. In the Xcode project, go to **File** \> **Add Package Dependencies** . Enter `https://github.com/googlemaps/ios-maps-sdk` as the URL, press **Enter** to pull in the package, and click **Add Package**.
4. 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.
5. [Get an API key](https://developers.google.com/maps/documentation/ios-sdk/get-api-key.md.txt) from your project with the [Maps SDK for iOS enabled](https://developers.google.com/maps/documentation/ios-sdk/cloud-setup#enabling-apis).
6. 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:

   ### Swift

   ```swift
   static let apiKey = "YOUR_API_KEY"
   ```

   ### Objective-C

   ```objective-c
   static NSString *const kAPIKey = @"YOUR_API_KEY";
   ```
7. 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:

   ### Swift

   ```swift
   #error (Register for API Key and insert here. Then delete this line.)
   ```

   ### Objective-C

   ```objective-c
   #error Register for API Key and insert here.
   ```
8. Build and run the project. The iOS simulator window appears, showing a list of **Maps SDK Demos**.
9. Choose one of the options displayed, to experiment with a feature of the Maps SDK for iOS.
10. If prompted to allow GoogleMapsDemos to access your location, choose **Allow**.