This repository provides one or more samples demonstrating use of various iOS SDKs in the Google Maps Platform.
This repository contains sample code for use with the
To run the samples, you will need:
- To sign up with Google Maps Platform
- A Google Maps Platform project with the relevant SDK enabled
- An API key associated with the project above ... follow the API key instructions if you're new to the process
- Swift or Objective-C
- Xcode 15+
- (Deployment target of) iOS 15+
The GoogleMaps
and GoogleMaps-Swift
sub-directory contains the sample code that is downloaded
when you run pod try GoogleMaps
. To use this project:
For Objective-C samples:
$ cd GoogleMaps
$ pod install
$ open GoogleMapsDemos.xcworkspace
For Swift (UIKit) samples:
$ cd GoogleMaps-Swift
$ pod install
$ open GoogleMapsSwiftDemos.xcworkspace
Add your API Key to GoogleMapsDemos/SDKDemoAPIKey.h
.
The GoogleMaps-SwiftUI
sub-directory contains sample code demonstrating how to integrate Google Maps SDK with SwiftUI applications. It provides a modern SwiftUI wrapper around GMSMapView
with a declarative API for common map configurations and interactions. To use this project:
$ cd GoogleMaps-SwiftUI
$ open GoogleMaps-SwiftUI.xcodeproj
This project uses Swift Package Manager and requires the GoogleMaps package. The sample code demonstrates best practices for integrating Google Maps into SwiftUI-based iOS applications.
The GooglePlaces
and GooglePlaces-Swift
sub-directory contains the sample code that is downloaded
when you run pod try GooglePlaces
. To use this project:
$ cd GooglePlaces
$ pod install
$ open GooglePlacesDemos.xcworkspace
For Swift samples:
$ cd GooglePlaces-Swift
$ pod install
$ open GooglePlacesSwiftDemos.xcworkspace
Add your API Key to GooglePlacesDemos/SDKDemoAPIKey.h
.
The GoogleNavigation
and GoogleNavigation-Swift
sub-directory contains the sample code that is downloaded
when you run pod try GoogleNavigation
. To use this project:
$ cd GoogleNavigation
$ pod install
$ open GoogleNavigationDemos.xcworkspace
For Swift samples:
$ cd GoogleNavigation-Swift
$ pod install
$ open GoogleNavigationSwiftDemos.xcworkspace
Add your API Key to GoogleNavigationDemos/SDKDemoAPIKey.h
.
This demo application looks to bridge some of the features found in the GooglePlaces and GoogleMaps demo applications as well as utilize some of the ways the two API's can work together. Click this link to watch a video demonstration.
- If you are emulating this from you Mac, please make sure to set the emulated phone's location (otherwise, location features will not work)
- A Google Cloud Platform API key with Maps SDK for iOS and Places SDK for iOS enabled
- A light and dark themed map, which can be created here (make sure you sign in first)
- If you want a different data set, ensure that it follows the correct formatting (and is also a JSON file) like the one provided (the data set provided can be found in dataset.json)
- Make sure you are in the right folder (MapsAndPlacesDemo)
- Run
pod install
- Open
MapsAndPlacesDemo.xcworkspace
- Drag the data set (dataset.json) into the Xcode file explorer (left pane)
The tutorials
sub-directory contains sample code that accompanies tutorials in the developer
documentation, such as
Adding a Map with a Marker,
and more. Follow the tutorials for a quick guide to using the SDK.
The snippets
sub-directory contains code snippets that can be found in the developer documentation site.
External contributions are not accepted for this repository. See contributing guide for more info.
This sample uses Google Maps Platform services. Use of Google Maps Platform services through this sample is subject to the Google Maps Platform Terms of Service.
This sample is not a Google Maps Platform Core Service. Therefore, the Google Maps Platform Terms of Service (e.g. Technical Support Services, Service Level Agreements, and Deprecation Policy) do not apply to the code in this sample.
This sample is offered via an open source license. It is not governed by the Google Maps Platform Support Technical Support Services Guidelines, the SLA, or the Deprecation Policy. However, any Google Maps Platform services used by the sample remain subject to the Google Maps Platform Terms of Service.
If you find a bug, or have a feature request, please file an issue on GitHub. If you would like to get answers to technical questions from other Google Maps Platform developers, ask through one of our developer community channels. If you'd like to contribute, please check the contributing guide.
If you find a bug or have a feature request related to one of the SDKs, you can file an issue at their respective pages:
- Maps SDK for iOS Issue Tracker
- Places SDK for iOS Issue Tracker
- Navigation SDK for iOS Issue Tracker
You can also discuss these samples on our Discord server.