This page describes what you need to do to get set up to start building with the
Maps 3D SDK for iOS. The setup process involves configuring a Google Cloud
project and API for use with the SDK, and then setting up an Xcode project.
Complete these steps before [adding your first 3D map to your
app](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/add-a-3d-map).

## Prerequisites

To use the Maps 3D SDK for iOS, your project and target devices must meet the
following requirements:

- **Minimum iOS version** : Target iOS **16.0** or later.
- **Xcode** : [Xcode](https://developer.apple.com/xcode/) **version
  16.0** or later.

## Set up a Google Cloud project and API key

Before you can start building with the Maps 3D SDK for iOS, you need to set up a
Google Cloud project and API key to use with the Maps 3D SDK for iOS by
completing the following steps:

### Step 1: Set up your project

#### Console

[Video](https://www.youtube.com/watch?v=uINleRduCWM)

1. In the Google Cloud console, on the project selector page, click
   **Create Project** to begin creating a new Cloud
   project.

   [Go to the project selector page](https://console.cloud.google.com/projectselector2/home/dashboard?utm_source=Docs_NewProject&utm_content=Docs_Central)
2. Make sure that billing is enabled for your Cloud project.
   [Confirm that billing is enabled for your project](https://console.cloud.google.com/project/_/billing?utm_source=Docs_Billing&utm_content=Docs_Central).

   Google Cloud offers a $0.00 charge trial. The trial expires at the end of 90
   days or after the account has accrued $300 worth of charges, whichever comes first. Cancel
   anytime. For more information, see
   [Billing account credits](https://developers.google.com/maps/billing-credits) and [Billing](https://developers.google.com/maps/billing-and-pricing/billing).

#### Cloud SDK

```bash
gcloud projects create "PROJECT"
```

Read more about the [Google Cloud SDK](https://cloud.google.com/sdk), [Cloud SDK installation](https://cloud.google.com/sdk/docs/install), and the following commands:

- [`gcloud projects create`](https://cloud.google.com/sdk/gcloud/reference/projects/create)

> [!NOTE]
> **Note**: If you don't plan to keep the resources that you create in a learning exercise, create a project instead of selecting an existing project. After you finish the exercise, you can delete the project, removing all resources associated with the project.

### Step 2: Enable APIs or SDKs

To use Google Maps Platform, you must enable the APIs or SDKs you plan to use with your project.

Note that some integrations require you to enable multiple APIs/SDKs. If you are not sure which
APIs or SDKs to enable, try using
the [Capabilities Explorer](https://developers.google.com/maps/documentation/capabilities-explorer.md.txt), or consult the
documentation for the API/SDK you want to use.

To enable one or more APIs or SDKs:

#### Console

[Video](https://www.youtube.com/watch?v=n1UorU1PALk)

1. See the Google Maps Platform APIs and SDKs that you can enable by going to the Maps API
   Library page in the Cloud console:

   Go to the [Maps API Library
   page](https://console.cloud.google.com/project/_/google/maps-apis/api-list?utm_source=Docs_EnableAPIs&utm_content=Docs_Central)
2. Click the API or SDK you want to enable.
   - If the button says **ENABLE**, click the button to enable the API or SDK.
   - If the button says **MANAGE**, the API or SDK is already enabled and you don't need to do anything further.
   - Clicking either button will display the dashboard for the API or SDK. (Click the **DISABLE** button to remove the API or SDK from this project.)

#### Cloud SDK

The following command enables all of the Maps, Routes, and Places APIs:

```bash
gcloud services enable \
    --project "PROJECT" \
    "addressvalidation.googleapis.com" \
    "areainsights.googleapis.com" \
    "tile.googleapis.com" \
    "aerialview.googleapis.com" \
    "elevation-backend.googleapis.com" \
    "routes.googleapis.com" \
    "geocoding-backend.googleapis.com" \
    "geolocation.googleapis.com" \
    "maps-android-backend.googleapis.com" \
    "maps-backend.googleapis.com" \
    "maps-embed-backend.googleapis.com" \
    "maps-ios-backend.googleapis.com" \
    "mapsplatformdatasets.googleapis.com" \
    "places-backend.googleapis.com" \
    "roads.googleapis.com" \
    "routeoptimization.googleapis.com" \
    "static-maps-backend.googleapis.com" \
    "street-view-image-backend.googleapis.com" \
    "timezone-backend.googleapis.com"
```

Read more about the [Google Cloud SDK](https://cloud.google.com/sdk), [Cloud SDK installation](https://cloud.google.com/sdk/docs/install), and the following commands:

- [`gcloud services enable`](https://cloud.google.com/sdk/gcloud/reference/services/enable)
- [`gcloud services disable`](https://cloud.google.com/sdk/gcloud/reference/services/disable)

Use this command to enable the Environment APIs:

```bash
gcloud services enable \
    --project "PROJECT" \
    "airquality.googleapis.com" \
    "solar.googleapis.com" \
    "pollen.googleapis.com" \
    "weather.googleapis.com"
```

> [!NOTE]
> **Note:** Enabling Places API also enables the Places Library, Maps JavaScript API, Places SDK for Android and Places SDK for iOS.

### Step 3: Get an API key

This step only goes through the API key creation process. If you use your API key in
production, we strongly recommend that you restrict your API key. You can find more
information in the product-specific **Using API Keys** page.

The API key is a unique identifier that authenticates requests associated with your project for
usage and billing purposes. You must have at least one API key associated with your project.
To create a new key or add an API or SDK to an existing key, follow these instructions.

#### Console

1. Go to the **Google Maps Platform \> Keys \& Credentials**
   page.

   [Go to the Keys \&
   Credentials page](https://console.cloud.google.com/projectselector/google/maps-apis/credentials?utm_source=Docs_CreateAPIKey&utm_content=Docs_Central)
2. If prompted, select your project.
3. Do one of the following:

   - **Create a new key**:

     1. Click **Create credentials \> API key**.
     2. In the **Create API key** panel, open the **Select API restrictions** list.
     3. Clear any APIs that this key doesn't need, and make sure the APIs that you plan to use stay selected.
     4. Click **Create**. The panel displays your new API key.
   - **Use an existing key**:

     1. Click the name of the key.
     2. In the **Select API restrictions** list, select the APIs that you plan to use.
     3. Click **Save**.

   Selecting an API here doesn't enable it. Make sure
   each API
   that you select is enabled in the
   [API Library](https://console.cloud.google.com/apis/library).
4. To see the key string later, go to the **Keys \& Credentials** page and click **Show key** for the key.

If the console looks different from these steps, see
[Create an API key](https://cloud.google.com/docs/authentication/api-keys#create) and
[Add API restrictions](https://cloud.google.com/docs/authentication/api-keys#adding-api-restrictions) in the Google Cloud documentation.

#### Cloud SDK

Replace <var translate="no">PROJECT_ID</var> with your project ID in the following
commands.

- **Create a new key** : Run the following command, and
  replace <var translate="no">DISPLAY_NAME</var> with a name for the key.
  Replace <var translate="no">SERVICE_NAME</var> with the service
  name of an API that you plan to use, such as
  `places.googleapis.com`. To allow more APIs, repeat the
  `--api-target` flag.

  ```bash
  gcloud services api-keys create \
      --project="PROJECT_ID" \
      --display-name="DISPLAY_NAME" \
      --api-target=service=SERVICE_NAME
  ```

  Read more about the [Google Cloud SDK](https://cloud.google.com/sdk), [Cloud SDK installation](https://cloud.google.com/sdk/docs/install), and the following commands:
  - [`gcloud services api-keys create`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/create)
- **Use an existing key** : Run the following command, and
  replace <var translate="no">KEY_ID</var> with the ID of the key.
  Replace <var translate="no">SERVICE_NAME</var> with the service
  name of the API to add. The `--append` flag keeps
  the APIs that the key already allows. Without it, the command replaces
  them.

  ```bash
  gcloud services api-keys update KEY_ID \
      --project="PROJECT_ID" \
      --append \
      --api-target=service=SERVICE_NAME
  ```

  Read more about the [Google Cloud SDK](https://cloud.google.com/sdk), [Cloud SDK installation](https://cloud.google.com/sdk/docs/install), and the following commands:
  - [`gcloud services api-keys update`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/update)
  - [`gcloud services api-keys list`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/list)

  The key ID isn't the key string or display name. To find it, run
  `gcloud services api-keys list --project="PROJECT_ID"`.
  The ID is the last part of
  the `name` field:
  `projects/PROJECT_NUMBER/locations/global/keys/KEY_ID`.

To see the key string, run
`gcloud services api-keys get-key-string KEY_ID
--project="PROJECT_ID"`.

To enable the SDK, see the [Maps 3D SDK for iOS](https://console.cloud.google.com/apis/library/mapsios.googleapis.com)
page in the Google Cloud console. For more information about completing these
steps, see [Getting started with the Google Maps Platform](https://developers.google.com/maps/get-started.md.txt).

## Set up an Xcode project

This section explains how to create and configure an Xcode project for use with
the Maps 3D SDK for iOS.

After you enable billing and create an API key, you're ready to set up the Xcode
project that you use to develop your app.

### Step 1: Install the required software

To build a project using the Maps 3D SDK for iOS, you must download and install:

- [Xcode](https://developer.apple.com/xcode/) **version
  16.0** or later

### Step 2: Create the Xcode project and install the Maps 3D SDK for iOS

### Swift Package Manager


The Maps 3D SDK for iOS can be installed using Swift Package Manager.

To add the SDK to a new or existing project, follow these steps:

- Open your Xcode `project` or `workspace`, then go to **File** \> **Add Package Dependencies**.
- Enter <https://github.com/googlemaps/ios-maps-3d-sdk> as the URL, press **Enter** to pull in the package, and click "Add Package".
- From the **Choose Package Products** window, verify that `GoogleMaps3D` will be added to your designated main target. Once complete, click **Add Package**.
- To verify your installation, navigate to your target's **General** pane. In **Frameworks, Libraries, and Embedded Content** , you should see the installed packages. You can also view the **Package Dependencies** section of **Project Navigator** to verify the package and its version.

### Step 3: Add the API key to your app

### Swift Package Manager

Add your API key to the main entry point for your app (or any time before the map loads) as follows.

1. Add the following import statement:

   ```swift
   import GoogleMaps3D
   ```
2. Add the following method. Replace `YOUR_API_KEY` with your API key.

   ```swift
   struct ContentView: View {
     init () {
       Map.apiKey = "YOUR_API_KEY"
     }

     var body: some View {
       Map(mode: .hybrid)
     }
   }
       
   ```

> [!NOTE]
> The API key can appear in your app's entry point or separately for each map view. If the API key is specified both in the entry point and the map views, however, the console will produce an error.

### Step 4 (optional): Inspect Apple Privacy Manifest file

> [!NOTE]
> **Note:** The following is relevant when you deploy your app to the web store.

Apple requires app privacy details for apps on the App Store.

The Apple Privacy Manifest file is included in the resources bundle for the SDK.
To verify that the Privacy Manifest File has been included, and to inspect its
contents, create an archive of your app and [generate a privacy
report](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests#4239187)
from the archive.

## Next steps

Now that you have a Google Cloud project, API key, and Xcode project
set up for use with the Maps 3D SDK for iOS, you can [Add a 3D map to your
app](https://developers.google.com/maps/documentation/maps-3d/ios-sdk/add-a-3d-map).