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

This page describes how to set up the
[utility library
for the Maps SDK for iOS](https://github.com/googlemaps/google-maps-ios-utils).

To try these utilities, you can either:

- [Install the utility library's into an existing Xcode project](https://developers.google.com/maps/documentation/ios-sdk/utility/setup.md.txt#get-utility). Add these utilities in your own project.
- [Install and run the demo app](https://developers.google.com/maps/documentation/ios-sdk/utility/setup.md.txt#get-demo). The demo app is a standalone project that contains all of the code required to try out the utilities.

## Add the Maps SDK for iOS Utility Library to an Xcode project

Follow these steps to add the utility library to your Xcode workspace:

### Use Swift Package Manager

1. If you don't have an Xcode project yet, create one now and save it to your local machine. (If you're new to iOS development, create a new project and select the **iOS App
   template** . On Xcode 11.7 or older, create a **Single View Application**.)
2. Add the Maps SDK for iOS as a dependency. See [Installing the SDK](https://developers.google.com/maps/documentation/ios-sdk/config.md.txt#download-sdk) for options.
3. In your Xcode project, navigate to **File** -\> **Swift Packages** -\> **Add Package Dependency**.
4. In the presented window, enter the Maps SDK for iOS Utility Library repository URL `https://github.com/googlemaps/google-maps-ios-utils` and select **Next**.
   - At this point, you may be prompted to authenticate with your GitHub account. Follow the instructions to create a [GitHub
     personal access token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) to continue the process.
5. In the next window, select the **Version** radio option, select **Up to Next Major Version** from the drop-down list, and enter the latest [version](https://github.com/googlemaps/google-maps-ios-utils/releases) of the Maps SDK for iOS Utility Library (for example, "6.0.0").
6. Click the drop-down next to **Add to Project** , select your project, and select **Add Package**.

### Add the API key to your app

See [Set up an Xcode Project](https://developers.google.com/maps/documentation/ios-sdk/config.md.txt) for instructions on generating an API key and adding it to your Xcode project.

### Build and run the project

After you add the API key, build and run the project.

### Use a utility in your app

See the documentation on each utility for more information on using it in your app:

- [Marker
  clustering](https://developers.google.com/maps/documentation/ios-sdk/utility/marker-clustering)
- [Quadtree](https://developers.google.com/maps/documentation/ios-sdk/utility/quadtree.md.txt)
- [KML rendering](https://developers.google.com/maps/documentation/ios-sdk/utility/kml.md.txt)
- [GeoJSON rendering](https://developers.google.com/maps/documentation/ios-sdk/utility/geojson.md.txt)
- [Heatmap](https://developers.google.com/maps/documentation/ios-sdk/utility/heatmap.md.txt)

## Install and run the demo app

The utility library includes a demo app that you can install and then try out each utility.
Install the demo app:

### Use files from GitHub

1. [Download
   the code sample archive](https://github.com/googlemaps/google-maps-ios-utils/archive/master.zip) from [GitHub](https://github.com/googlemaps/google-maps-ios-utils/tree/master/samples) and unpack the archive. Alternatively, clone the repository into a local directory:

   ```
   git clone https://github.com/googlemaps/google-maps-ios-utils.git
   ```
2. Open a terminal window, navigate to the directory where you expanded the sample files, and drill down into the appropriate samples directory for the language you want to use:

   ### Swift

       cd google-maps-ios-utils/samples/SwiftDemoApp
       open SwiftDemoApp.xcodeproj

   ### Objective-C

       cd google-maps-ios-utils/samples/ObjCDemoApp
       open ObjCDemoApp.xcodeproj

### Add the API key to the demo app

In [Get an API key](https://developers.google.com/maps/documentation/ios-sdk/get-api-key.md.txt), you generate an API key for your app. Now add that key to the Xcode project for the demo app.

> [!NOTE]
> **Note:** If your API key uses an **Application restriction** , ensure that you add the bundle identifier of your app to the key. For example, if you are running the demo app, the bundle identifier is `com.google.gmsutils.DemoApp`. See [Get an API key](https://developers.google.com/maps/documentation/ios-sdk/get-api-key.md.txt) for more information on restricting a key.

### Swift

Add your API key to your `AppDelegate.swift` as follows:

1. Add the following import statement:

   ```swift
   import GoogleMaps
   ```
2. Edit the following line to add your API key between the double quotes:

   ```swift
   // Change this key to a valid key registered with the demo app bundle id.
   let mapsAPIKey = ""
   ```

### Objective-C

Add your API key to your `AppDelegate.m` as follows:

1. Add the following import statement:

   ```objective-c
   @import GoogleMaps;
   ```
2. Edit the following line to add your API key between the double quotes:

   ```objective-c
   // Change this key to a valid key registered with the demo app bundle id.
   static NSString *const kMapsAPIKey = @"";
   ```

### Build and run the demo app

After you add the API key, build and run the project:

- If you are running the Swift version of the demo, you can select which utility to view in the app.
- If you are running the Objective-C version of the demo, you see the demo of the marker clustering utility. You can then edit the Objective-C version of the demo to try each utility. See the [Add a utility to your app](https://developers.google.com/maps/documentation/ios-sdk/utility/setup.md.txt#add_utility) section below for more information.