# PlacesClient

    final class PlacesClient

    extension PlacesClient : https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Protocols/PlacesClientProtocol.html, Sendable, SendableMetatype

Main interface to the Places SDK, used for searching and getting details about places.

This type should be accessed through `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient.html#/s:17GooglePlacesSwift0B6ClientC6sharedACvpZ`.

`PlacesClient` methods should only be called from the main thread. Calling these methods from
another thread will result in an exception or undefined behavior.
- `


  ### [addInternalUsageAttributionID(_:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC29addInternalUsageAttributionIDyySSFZ)


  ` 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)

- `


  ### [fetchAutocompleteSuggestions(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC28fetchAutocompleteSuggestions4withs6ResultOySayAA0F10SuggestionOGAA0B5ErrorOGAA0F7RequestV_tYaF)


  `

  #### Declaration

  Swift

      final func fetchAutocompleteSuggestions(with request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/AutocompleteRequest.html) async -> Result<[https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/AutocompleteSuggestion.html], https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

- `


  ### [fetchPhoto(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC10fetchPhoto4withs6ResultOySo7UIImageCAA0B5ErrorOGAA05FetchF7RequestV_tYaF)


  `

  #### Declaration

  Swift

      @available(*, deprecated, message: "This API is deprecated, please use the Place Details component (https://developers.google.com/maps/documentation/places/ios-sdk/place-details-ui-kit﹚ instead.")
      final func fetchPhoto(with request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/FetchPhotoRequest.html) async -> Result<UIImage, https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

- `


  ### [fetchPlace(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC10fetchPlace4withs6ResultOyAA0F0VAA0B5ErrorOGAA05FetchF7RequestV_tYaF)


  ` Get a place using a request object.

  #### Declaration

  Swift

      final func fetchPlace(with request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/FetchPlaceRequest.html) async -> Result<https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/Place.html, https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

  #### Parameters

  |---|---|
  | ` with ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/FetchPlaceRequest.html` The fetch place request to use for the query. |

  #### Return Value

  A `Result` with the `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/Place.html` response for the request, or a `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html`.
- `


  ### [isPlaceOpen(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC11isPlaceOpen4withs6ResultOyAA02IsfG8ResponseVAA0B5ErrorOGAA0jfG7RequestV_tYaF)


  ` 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: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/IsPlaceOpenRequest.html) async -> Result<https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/IsPlaceOpenResponse.html, https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

  #### Return Value

  A `PlaceIsOpenResponse` with the `Bool?` status for the requested place, or a
  `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html`.
- `


  ### [openSourceLicenseInfo](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC21openSourceLicenseInfoSSvpZ)


  ` 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 }

- `


  ### [provideAPIKey(_:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC13provideAPIKeyySbSSFZ)


  ` 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.
- `


  ### [responseForSearchByText(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC23responseForSearchByText4withs6ResultOyAA0ghI8ResponseVAA0B5ErrorOGAA0ghI7RequestV_tYaF)


  ` Search for places by text and restrictions.

  #### Declaration

  Swift

      final func responseForSearchByText(with request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchByTextRequest.html) async -> Result<https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchByTextResponse.html, https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

  #### Parameters

  |---|---|
  | ` with ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchByTextRequest.html` The text request to use for the query. |

  #### Return Value

  A `Result` with the `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchByTextResponse.html` response for the request, or a
  `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html`.
- `


  ### [responseForSearchNearby(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC23responseForSearchNearby4withs6ResultOyAA0gH8ResponseVAA0B5ErrorOGAA0gH7RequestV_tYaF)


  ` Search for places near a location and restriction.

  #### Declaration

  Swift

      final func responseForSearchNearby(with request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchNearbyRequest.html) async -> Result<https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchNearbyResponse.html, https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

  #### Parameters

  |---|---|
  | ` with ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchNearbyRequest.html` The search nearby request to use for the query. |

  #### Return Value

  A `Result` with the `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchNearbyResponse.html` response for the request, or a
  `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html`.
- `


  ### [sdkLongVersion](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC14sdkLongVersionSSvpZ)


  ` 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 }

- `


  ### [sdkVersion](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC10sdkVersionSSvpZ)


  ` 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 }

- `


  ### [searchByText(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC12searchByText4withs6ResultOySayAA5PlaceVGAA0B5ErrorOGAA06SearchfG7RequestV_tYaF)


  ` Search for places by text and restrictions.

  #### Declaration

  Swift

      @available(*, deprecated, message: "Use `responseForSearchByText` instead.")
      final func searchByText(with request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchByTextRequest.html) async -> Result<[https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/Place.html], https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

  #### Parameters

  |---|---|
  | ` with ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchByTextRequest.html` The text request to use for the query. |

  #### Return Value

  A `Result` with the `[Place]` response for the request, or a `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html`.
- `


  ### [searchNearby(with:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC12searchNearby4withs6ResultOySayAA5PlaceVGAA0B5ErrorOGAA06SearchF7RequestV_tYaF)


  ` Search for places near a location and restriction.

  #### Declaration

  Swift

      @available(*, deprecated, message: "Use `responseForSearchNearby` instead.")
      final func searchNearby(with request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchNearbyRequest.html) async -> Result<[https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/Place.html], https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html>

  #### Parameters

  |---|---|
  | ` with ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/SearchNearbyRequest.html` The search nearby request to use for the query. |

  #### Return Value

  A `Result` with the `[Place]` response for the request, or a `https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/PlacesError.html`.
- `


  ### [setAppCheckTokenProvider(_:)](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC24setAppCheckTokenProvideryyAA0fghI0_pFZ)


  ` 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:).

  #### Declaration

  Swift

      @MainActor
      static func setAppCheckTokenProvider(_ tokenProvider: any https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Protocols/AppCheckTokenProvider.html)

  #### Parameters

  |---|---|
  | ` tokenProvider ` | The App Check token provider. |

- `


  ### [shared](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Classes/PlacesClient#/s:17GooglePlacesSwift0B6ClientC6sharedACvpZ)


  ` 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 }