GooglePlacesSwift Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
PlacesClient
Main interface to the Places SDK, used for searching and getting details about places.
This type should be accessed through PlacesClient.shared
.
PlacesClient
methods should only be called from the main thread. Calling these methods from
another thread will result in an exception or undefined behavior.
-
Adds a usage attribution ID to the initializer, which helps Google understand which
libraries and samples are helpful to developers, such as usage of a marker clustering
library.
To opt out of sending the usage attribution ID, it is safe to delete this function call or
replace the value with an empty string.
Declaration
Swift
@MainActor
static func addInternalUsageAttributionID(_ internalUsageAttributionID: String)
-
-
Get a place using a request object.
Return Value
A Result
with the UIImage
response for the request, or a PlacesError
.
-
Get a place using a request object.
Return Value
A Result
with the Place
response for the request, or a PlacesError
.
-
Gets the open status for a place.
Gets details for a place including all properties necessary to determine if it is open at
the optionally specified Date
.
Return Value
A PlaceIsOpenResponse
with the Bool?
status for the requested place, or a
PlacesError
.
-
Returns the open source software license information for the Google Places SDK for iOS. This
information must be made available within your application.
Declaration
Swift
static var openSourceLicenseInfo: String { get }
-
Provides your API key to the Google Places SDK for iOS.
This key is generated for your application via the Google Cloud Platform Console, and is
paired with your application’s bundle ID to identify it. This should be called by your
application before using PlacesClient (e.g., in application:didFinishLaunchingWithOptions:).
Declaration
Swift
@MainActor
static func provideAPIKey(_ key: String) -> Bool
Return Value
true if the APIKey was successfully provided.
-
Returns the long version for this release of the Google Places SDK for iOS. For example,
“1.0.0 (102.1)”.
Declaration
Swift
static var sdkLongVersion: String { get }
-
Returns the version for this release of the Google Places SDK for iOS. For example, “1.0.0”.
Declaration
Swift
static var sdkVersion: String { get }
-
Search for places by text and restrictions.
Return Value
A Result
with the [Place]
response for the request, or a PlacesError
.
-
Search for places near a location and restriction.
Return Value
A Result
with the [Place]
response for the request, or a PlacesError
.
-
Provides the App Check token provider to the Google Places SDK for iOS.
This token provider is used to fetch the App Check token. This should be called by your
application before using PlacesClient (for example, in
application:didFinishLaunchingWithOptions:).
Parameters
tokenProvider
|
The App Check token provider.
|
-
Provides the shared instance of PlacesClient for the Google Places SDK for iOS, creating it if
necessary.
If your application often uses methods of PlacesClient it may want to retain this object
directly, as otherwise your connection to Google may be restarted on a regular basis.
Note
Google Places SDK for iOS must be initialized via PlacesClient.provideAPIKey(…)
prior to use.
Declaration
Swift
@MainActor
unowned static var shared: PlacesClient { get }
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003ePlacesClient\u003c/code\u003e is the primary interface for interacting with the Google Places SDK, enabling functionalities like place searching and retrieval of place details.\u003c/p\u003e\n"],["\u003cp\u003eAccess the \u003ccode\u003ePlacesClient\u003c/code\u003e through its shared instance, \u003ccode\u003ePlacesClient.shared\u003c/code\u003e, after initializing the SDK with your API key using \u003ccode\u003ePlacesClient.provideAPIKey(_)\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAll \u003ccode\u003ePlacesClient\u003c/code\u003e methods should be executed on the main thread to avoid exceptions or unexpected behavior.\u003c/p\u003e\n"],["\u003cp\u003eThe SDK offers methods for fetching autocomplete suggestions, photos, place details, and determining a place's open status, along with utilities for accessing license information and SDK version details.\u003c/p\u003e\n"]]],[],null,["# GooglePlacesSwift Framework Reference\n\nPlacesClient\n============\n\n final class PlacesClient\n\n extension PlacesClient : ../Protocols/PlacesClientProtocol.html, Sendable\n\nMain interface to the Places SDK, used for searching and getting details about places.\n\nThis type should be accessed through [PlacesClient.shared](../Classes/PlacesClient.html#/s:17GooglePlacesSwift0B6ClientC6sharedACvpZ).\n\n`PlacesClient` methods should only be called from the main thread. Calling these methods from\nanother thread will result in an exception or undefined behavior.\n- `\n ``\n ``\n `\n\n ### [addInternalUsageAttributionID(_:)](#/s:17GooglePlacesSwift0B6ClientC29addInternalUsageAttributionIDyySSFZ)\n\n `\n ` \n Adds a usage attribution ID to the initializer, which helps Google understand which\n libraries and samples are helpful to developers, such as usage of a marker clustering\n library.\n To opt out of sending the usage attribution ID, it is safe to delete this function call or\n replace the value with an empty string. \n\n #### Declaration\n\n Swift \n\n @MainActor\n static func addInternalUsageAttributionID(_ internalUsageAttributionID: String)\n\n- `\n ``\n ``\n `\n\n ### [fetchAutocompleteSuggestions(with:)](#/s:17GooglePlacesSwift0B6ClientC28fetchAutocompleteSuggestions4withs6ResultOySayAA0F10SuggestionOGAA0B5ErrorOGAA0F7RequestV_tYaF)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n final func fetchAutocompleteSuggestions(with request: ../Structs/AutocompleteRequest.html) async -\u003e Result\u003c[../Enums/AutocompleteSuggestion.html], ../Enums/PlacesError.html\u003e\n\n- `\n ``\n ``\n `\n\n ### [fetchPhoto(with:)](#/s:17GooglePlacesSwift0B6ClientC10fetchPhoto4withs6ResultOySo7UIImageCAA0B5ErrorOGAA05FetchF7RequestV_tYaF)\n\n `\n ` \n Get a place using a request object. \n\n #### Declaration\n\n Swift \n\n final func fetchPhoto(with request: ../Structs/FetchPhotoRequest.html) async -\u003e Result\u003cUIImage, ../Enums/PlacesError.html\u003e\n\n #### Parameters\n\n |--------------|----------------------------------------------------------------------------------|\n | ` `*with*` ` | The [FetchPhotoRequest](../Structs/FetchPhotoRequest.html) to use for the query. |\n\n #### Return Value\n\n A `Result` with the `UIImage` response for the request, or a [PlacesError](../Enums/PlacesError.html).\n- `\n ``\n ``\n `\n\n ### [fetchPlace(with:)](#/s:17GooglePlacesSwift0B6ClientC10fetchPlace4withs6ResultOyAA0F0VAA0B5ErrorOGAA05FetchF7RequestV_tYaF)\n\n `\n ` \n Get a place using a request object. \n\n #### Declaration\n\n Swift \n\n final func fetchPlace(with request: ../Structs/FetchPlaceRequest.html) async -\u003e Result\u003c../Structs/Place.html, ../Enums/PlacesError.html\u003e\n\n #### Parameters\n\n |--------------|------------------------------------------------------------------------------------------------------|\n | ` `*with*` ` | [FetchPlaceRequest](../Structs/FetchPlaceRequest.html) The fetch place request to use for the query. |\n\n #### Return Value\n\n A `Result` with the [Place](../Structs/Place.html) response for the request, or a [PlacesError](../Enums/PlacesError.html).\n- `\n ``\n ``\n `\n\n ### [isPlaceOpen(with:)](#/s:17GooglePlacesSwift0B6ClientC11isPlaceOpen4withs6ResultOyAA02IsfG8ResponseVAA0B5ErrorOGAA0jfG7RequestV_tYaF)\n\n `\n ` \n Gets the open status for a place.\n\n Gets details for a place including all properties necessary to determine if it is open at\n the optionally specified `Date`. \n\n #### Declaration\n\n Swift \n\n final func isPlaceOpen(with request: ../Structs/IsPlaceOpenRequest.html) async -\u003e Result\u003c../Structs/IsPlaceOpenResponse.html, ../Enums/PlacesError.html\u003e\n\n #### Return Value\n\n A `PlaceIsOpenResponse` with the `Bool?` status for the requested place, or a\n [PlacesError](../Enums/PlacesError.html).\n- `\n ``\n ``\n `\n\n ### [openSourceLicenseInfo](#/s:17GooglePlacesSwift0B6ClientC21openSourceLicenseInfoSSvpZ)\n\n `\n ` \n Returns the open source software license information for the Google Places SDK for iOS. This\n information must be made available within your application. \n\n #### Declaration\n\n Swift \n\n static var openSourceLicenseInfo: String { get }\n\n- `\n ``\n ``\n `\n\n ### [provideAPIKey(_:)](#/s:17GooglePlacesSwift0B6ClientC13provideAPIKeyySbSSFZ)\n\n `\n ` \n Provides your API key to the Google Places SDK for iOS.\n\n This key is generated for your application via the Google Cloud Platform Console, and is\n paired with your application's bundle ID to identify it. This should be called by your\n application before using PlacesClient (e.g., in application:didFinishLaunchingWithOptions:). \n\n #### Declaration\n\n Swift \n\n @MainActor\n static func provideAPIKey(_ key: String) -\u003e Bool\n\n #### Return Value\n\n true if the APIKey was successfully provided.\n- `\n ``\n ``\n `\n\n ### [sdkLongVersion](#/s:17GooglePlacesSwift0B6ClientC14sdkLongVersionSSvpZ)\n\n `\n ` \n Returns the long version for this release of the Google Places SDK for iOS. For example,\n \"1.0.0 (102.1)\". \n\n #### Declaration\n\n Swift \n\n static var sdkLongVersion: String { get }\n\n- `\n ``\n ``\n `\n\n ### [sdkVersion](#/s:17GooglePlacesSwift0B6ClientC10sdkVersionSSvpZ)\n\n `\n ` \n Returns the version for this release of the Google Places SDK for iOS. For example, \"1.0.0\". \n\n #### Declaration\n\n Swift \n\n static var sdkVersion: String { get }\n\n- `\n ``\n ``\n `\n\n ### [searchByText(with:)](#/s:17GooglePlacesSwift0B6ClientC12searchByText4withs6ResultOySayAA5PlaceVGAA0B5ErrorOGAA06SearchfG7RequestV_tYaF)\n\n `\n ` \n Search for places by text and restrictions. \n\n #### Declaration\n\n Swift \n\n final func searchByText(with request: ../Structs/SearchByTextRequest.html) async -\u003e Result\u003c[../Structs/Place.html], ../Enums/PlacesError.html\u003e\n\n #### Parameters\n\n |--------------|---------------------------------------------------------------------------------------------------|\n | ` `*with*` ` | [SearchByTextRequest](../Structs/SearchByTextRequest.html) The text request to use for the query. |\n\n #### Return Value\n\n A `Result` with the `[Place]` response for the request, or a [PlacesError](../Enums/PlacesError.html).\n- `\n ``\n ``\n `\n\n ### [searchNearby(with:)](#/s:17GooglePlacesSwift0B6ClientC12searchNearby4withs6ResultOySayAA5PlaceVGAA0B5ErrorOGAA06SearchF7RequestV_tYaF)\n\n `\n ` \n Search for places near a location and restriction. \n\n #### Declaration\n\n Swift \n\n final func searchNearby(with request: ../Structs/SearchNearbyRequest.html) async -\u003e Result\u003c[../Structs/Place.html], ../Enums/PlacesError.html\u003e\n\n #### Parameters\n\n |--------------|------------------------------------------------------------------------------------------------------------|\n | ` `*with*` ` | [SearchNearbyRequest](../Structs/SearchNearbyRequest.html) The search nearby request to use for the query. |\n\n #### Return Value\n\n A `Result` with the `[Place]` response for the request, or a [PlacesError](../Enums/PlacesError.html).\n- `\n ``\n ``\n `\n\n ### [setAppCheckTokenProvider(_:)](#/s:17GooglePlacesSwift0B6ClientC24setAppCheckTokenProvideryyAA0fghI0_pFZ)\n\n `\n ` \n Provides the App Check token provider to the Google Places SDK for iOS.\n\n This token provider is used to fetch the App Check token. This should be called by your\n application before using PlacesClient (for example, in\n application:didFinishLaunchingWithOptions:). \n\n #### Declaration\n\n Swift \n\n @MainActor\n static func setAppCheckTokenProvider(_ tokenProvider: any ../Protocols/AppCheckTokenProvider.html)\n\n #### Parameters\n\n |-----------------------|-------------------------------|\n | ` `*tokenProvider*` ` | The App Check token provider. |\n\n- `\n ``\n ``\n `\n\n ### [shared](#/s:17GooglePlacesSwift0B6ClientC6sharedACvpZ)\n\n `\n ` \n Provides the shared instance of PlacesClient for the Google Places SDK for iOS, creating it if\n necessary.\n\n If your application often uses methods of PlacesClient it may want to retain this object\n directly, as otherwise your connection to Google may be restarted on a regular basis. \n Note\n Google Places SDK for iOS must be initialized via PlacesClient.provideAPIKey(...) prior to use. \n\n #### Declaration\n\n Swift \n\n @MainActor\n unowned static var shared: PlacesClient { get }"]]