PlacesClient methods should only be called from the main thread. Calling these methods from
another thread will result in an exception or undefined behavior. Unless otherwise specified,
all callbacks will be invoked on the main thread.
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.
Returns the open source software license information for the Google Places SDK for iOS. This
information must be made available within your application.
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:).
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:).
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003ePlacesClientProtocol\u003c/code\u003e is the primary interface for interacting with the Google Places SDK for iOS, enabling functionalities like place searching and retrieval of place details.\u003c/p\u003e\n"],["\u003cp\u003eIt's accessible through the shared instance \u003ccode\u003ePlacesClient.shared\u003c/code\u003e and all its methods should be called from the main thread for expected behavior.\u003c/p\u003e\n"],["\u003cp\u003eThe protocol provides methods to fetch autocomplete suggestions, photos, place details, determine place openness, search for places by text or proximity, and more.\u003c/p\u003e\n"],["\u003cp\u003eIt also includes functionalities to provide your API key and App Check token provider for authentication and security purposes.\u003c/p\u003e\n"],["\u003cp\u003eThe protocol exposes properties for retrieving SDK version information and open source license details.\u003c/p\u003e\n"]]],["The `PlacesClientProtocol` offers methods for interacting with the Places SDK, accessed via `PlacesClient.shared`. Core actions include: fetching autocomplete suggestions, photos, and place details via request objects. It also supports searching for places by text or nearby location. Additional functionalities include checking a place's open status, providing an API key, providing App check token, accessing SDK version information, and license information. All methods are called from the main thread and provide async callbacks.\n"],null,["# GooglePlacesSwift Framework Reference\n\nPlacesClientProtocol\n====================\n\n protocol PlacesClientProtocol : AnyObject, 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\nPlacesClient methods should only be called from the main thread. Calling these methods from\nanother thread will result in an exception or undefined behavior. Unless otherwise specified,\nall callbacks will be invoked on the main thread.\n- `\n ``\n ``\n `\n\n ### [addInternalUsageAttributionID(_:)](#/s:17GooglePlacesSwift0B14ClientProtocolP29addInternalUsageAttributionIDyySSFZ)\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:17GooglePlacesSwift0B14ClientProtocolP28fetchAutocompleteSuggestions4withs6ResultOySayAA0G10SuggestionOGAA0B5ErrorOGAA0G7RequestV_tYaF)\n\n `\n ` \n\n #### Declaration\n\n Swift \n\n 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:17GooglePlacesSwift0B14ClientProtocolP10fetchPhoto4withs6ResultOySo7UIImageCAA0B5ErrorOGAA05FetchG7RequestV_tYaF)\n\n `\n ` \n Get a place using a request object. \n\n #### Declaration\n\n Swift \n\n 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:17GooglePlacesSwift0B14ClientProtocolP10fetchPlace4withs6ResultOyAA0G0VAA0B5ErrorOGAA05FetchG7RequestV_tYaF)\n\n `\n ` \n Get a place using a request object. \n\n #### Declaration\n\n Swift \n\n 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:17GooglePlacesSwift0B14ClientProtocolP11isPlaceOpen4withs6ResultOyAA02IsgH8ResponseVAA0B5ErrorOGAA0kgH7RequestV_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 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:17GooglePlacesSwift0B14ClientProtocolP21openSourceLicenseInfoSSvpZ)\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:17GooglePlacesSwift0B14ClientProtocolP13provideAPIKeyySbSSFZ)\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:17GooglePlacesSwift0B14ClientProtocolP14sdkLongVersionSSvpZ)\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:17GooglePlacesSwift0B14ClientProtocolP10sdkVersionSSvpZ)\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:17GooglePlacesSwift0B14ClientProtocolP12searchByText4withs6ResultOySayAA5PlaceVGAA0B5ErrorOGAA06SearchgH7RequestV_tYaF)\n\n `\n ` \n Search for places by text and restrictions. \n\n #### Declaration\n\n Swift \n\n 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:17GooglePlacesSwift0B14ClientProtocolP12searchNearby4withs6ResultOySayAA5PlaceVGAA0B5ErrorOGAA06SearchG7RequestV_tYaF)\n\n `\n ` \n Search for places near a location and restriction. \n\n #### Declaration\n\n Swift \n\n 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:17GooglePlacesSwift0B14ClientProtocolP24setAppCheckTokenProvideryyAA0ghiJ0_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:17GooglePlacesSwift0B14ClientProtocolP6sharedxvpZ)\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 static var shared: Self { get }"]]