AI-generated Key Takeaways
- 
          PlacesClientProtocolis the primary interface for interacting with the Google Places SDK for iOS, enabling functionalities like place searching and retrieval of place details.
- 
          It's accessible through the shared instance PlacesClient.sharedand all its methods should be called from the main thread for expected behavior.
- 
          The protocol provides methods to fetch autocomplete suggestions, photos, place details, determine place openness, search for places by text or proximity, and more. 
- 
          It also includes functionalities to provide your API key and App Check token provider for authentication and security purposes. 
- 
          The protocol exposes properties for retrieving SDK version information and open source license details. 
PlacesClientProtocol
protocol PlacesClientProtocol : AnyObject, SendableMain 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. 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. DeclarationSwift @MainActor static func addInternalUsageAttributionID(_ internalUsageAttributionID: String)
- 
                  
                  DeclarationSwift func fetchAutocompleteSuggestions(with request: AutocompleteRequest) async -> Result<[AutocompleteSuggestion], PlacesError>
- 
                  
                  Get a place using a request object. DeclarationSwift func fetchPhoto(with request: FetchPhotoRequest) async -> Result<UIImage, PlacesError>ParameterswithThe FetchPhotoRequestto use for the query.Return ValueA Resultwith theUIImageresponse for the request, or aPlacesError.
- 
                  
                  Get a place using a request object. DeclarationSwift func fetchPlace(with request: FetchPlaceRequest) async -> Result<Place, PlacesError>ParameterswithFetchPlaceRequestThe fetch place request to use for the query.Return ValueA Resultwith thePlaceresponse for the request, or aPlacesError.
- 
                  
                  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.DeclarationSwift func isPlaceOpen(with request: IsPlaceOpenRequest) async -> Result<IsPlaceOpenResponse, PlacesError>Return ValueA PlaceIsOpenResponsewith theBool?status for the requested place, or aPlacesError.
- 
                  
                  Returns the open source software license information for the Google Places SDK for iOS. This information must be made available within your application. DeclarationSwift 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:). DeclarationSwift @MainActor static func provideAPIKey(_ key: String) -> BoolReturn Valuetrue 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)”. DeclarationSwift static var sdkLongVersion: String { get }
- 
                  
                  Returns the version for this release of the Google Places SDK for iOS. For example, “1.0.0”. DeclarationSwift static var sdkVersion: String { get }
- 
                  
                  Search for places by text and restrictions. DeclarationSwift func searchByText(with request: SearchByTextRequest) async -> Result<[Place], PlacesError>ParameterswithSearchByTextRequestThe text request to use for the query.Return ValueA Resultwith the[Place]response for the request, or aPlacesError.
- 
                  
                  Search for places near a location and restriction. DeclarationSwift func searchNearby(with request: SearchNearbyRequest) async -> Result<[Place], PlacesError>ParameterswithSearchNearbyRequestThe search nearby request to use for the query.Return ValueA Resultwith the[Place]response for the request, or aPlacesError.
- 
                  
                  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:). DeclarationSwift @MainActor static func setAppCheckTokenProvider(_ tokenProvider: any AppCheckTokenProvider)ParameterstokenProviderThe 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.DeclarationSwift @MainActor static var shared: Self { get }