PlacesClient
final class PlacesClient
extension PlacesClient : PlacesClientProtocol
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.
-
Undocumented
Declaration
Swift
final func fetchAutocompleteSuggestions(with request: AutocompleteRequest) async -> Result<[AutocompleteSuggestion], PlacesError>
-
Get a place using a request object.
Declaration
Swift
final func fetchPhoto(with request: FetchPhotoRequest) async -> Result<UIImage, PlacesError>
Parameters
with
The
FetchPhotoRequest
to use for the query.Return Value
A
Result
with theUIImage
response for the request, or aPlacesError
. -
Get a place using a request object.
Declaration
Swift
final func fetchPlace(with request: FetchPlaceRequest) async -> Result<Place, PlacesError>
Parameters
with
FetchPlaceRequest
The fetch place request to use for the query.Return Value
A
Result
with thePlace
response 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
.Declaration
Swift
final func isPlaceOpen(with request: IsPlaceOpenRequest) async -> Result<IsPlaceOpenResponse, PlacesError>
Return Value
A
PlaceIsOpenResponse
with 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.
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
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.
Declaration
Swift
final func searchByText(with request: SearchByTextRequest) async -> Result<[Place], PlacesError>
Parameters
with
SearchByTextRequest
The text request to use for the query.Return Value
A
Result
with the[Place]
response for the request, or aPlacesError
. -
Search for places near a location and restriction.
Declaration
Swift
final func searchNearby(with request: SearchNearbyRequest) async -> Result<[Place], PlacesError>
Parameters
with
SearchNearbyRequest
The search nearby request to use for the query.Return Value
A
Result
with the[Place]
response for the request, or aPlacesError
. -
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 }