The GooglePlacesDemos folder contains a demo application showcasing various features of the Places Swift SDK for iOS.
- Xcode 15.3 or later with the iOS SDK 15.0 or later.
- A Simulator for a device running iOS 15 or later, or an iOS device connected to your computer as a run destination for Xcode.
- An API key from a Google Cloud project with the Places API (New) enabled. See Get an API key after enabling the API.
- Set up a Google Cloud project and enable the Places API (New)
- Get an API key from the project
- Clone this repository
git clone [email protected]:googlemaps-samples/ios-places-sdk-samples.git
- Change into the
GooglePlacesDemos
foldercd ios-places-sdk-samples/GooglePlacesDemos
- Open GooglePlacesDemos.xcodeproj to open the project in Xcode.
open GooglePlacesDemos.xcodeproj/
- Create a local configuration file for your API key in the same directory (
GooglePlacesDemos/GooglePlacesDemos
) as the demo application's "Info.plist" file. Name the file "GooglePlacesDemos.xcconfig". This will not be checked into source control since .xcconfig is on the .gitignore list. - Add one line to
GooglePlacesDemos.xcconfig
to set the value of your API key. Substitute the "YOUR_API_KEY" in the snippet below with your API key from Step 2.This should be enough for the demo app to retrieve your key to use for requests. (See https://help.apple.com/xcode/#/dev745c5c974 for more information about xcconfig files.)API_KEY = "YOUR_API_KEY"
- Run the app. The Swift package for GooglePlacesSwift should automatically
A list of samples is presented at app startup. These samples each demonstrate a specific capability or capabilities of the SDK. The "Samples" directory contains most of the actual sample code. Everything else - with the exception of ParameterConfiguration.swift - is just scaffolding for the sample app to enable easy display of various samples.
The "Configure" button on the startup page allows setting place properties and
autocomplete filter options that allows easy configuration that can apply to
multiple samples. These options are set in ParameterConfiguration.swift which
can be used as a reference for using PlaceType
and AutocompleteFilter
.
- Overview page for the Places Swift SDK for iOS
- Reference documentation
- Migration guide for migrating from the Places SDK for iOS
Please see CONTRIBUTING.md.
This repository uses Google Maps Platform services. Use of Google Maps Platform services through this library is subject to the Google Maps Platform Terms of Service.
This repository 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 repository.
This repository 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 library 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.
You can also discuss this library on our Discord server.