GooglePlacesSwift Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
PlaceSearchView
@MainActor
struct PlaceSearchView
extension PlaceSearchView : Sendable, View
-
The type of view representing the body of this view.
When you create a custom view, Swift infers this type from your
implementation of the required View/body-swift.property
property.
Declaration
Swift
@available(watchOS, introduced: 6.0)
@available(macOS, introduced: 10.15)
@available(iOS, introduced: 13.0)
@available(tvOS, introduced: 13.0)
typealias Body = some View
-
-
The content and behavior of the view.
When you implement a custom view, you must implement a computed
body
property to provide the content for your view. Return a view
that’s composed of built-in views that SwiftUI provides, plus other
composite views that you’ve already defined:
struct MyView: View {
var body: some View {
Text("Hello, World!")
}
}
For more information about composing views and a view hierarchy,
see doc:Declaring-a-Custom-View.
Declaration
Swift
@MainActor
@preconcurrency
var body: some View { get }
-
Creates a list of place search results.
Parameters
orientation
|
The orientation of the view.
|
request
|
The request for the view, which is used when fetching the place search results.
|
configuration
|
The configuration settings for the view.
|
Return Value
A view that displays a list of place search results.
-
Adds a callback to be called when the place results are loaded.
Declaration
Swift
@MainActor
func onLoad(_ callback: @escaping ([Place]) -> Void) -> PlaceSearchView
Parameters
callback
|
The callback to be called when the place results are loaded.
|
Return Value
The PlaceSearchView with the callback added.
-
Adds a callback to be called when a place is selected.
Declaration
Swift
@MainActor
func onPlaceSelected(_ callback: @escaping (Place) -> Void) -> PlaceSearchView
Parameters
callback
|
The callback to be called when a place is selected.
|
Return Value
The PlaceSearchView with the callback added.
-
Adds a callback to be called when the place search request fails.
Declaration
Swift
@MainActor
func onRequestError(_ callback: @escaping (PlacesError) -> Void) -> PlaceSearchView
Parameters
callback
|
The callback to be called if the search request fails.
|
Return Value
The PlaceSearchView with the callback added.
-
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."],[],[],null,["# GooglePlacesSwift Framework Reference\n\nPlaceSearchView\n===============\n\n @MainActor\n struct PlaceSearchView\n\n extension PlaceSearchView : Sendable, View\n\n- `\n ``\n ``\n `\n\n ### [Body](#/s:17GooglePlacesSwift15PlaceSearchViewV4Bodya)\n\n `\n ` \n The type of view representing the body of this view.\n\n When you create a custom view, Swift infers this type from your\n implementation of the required `View/body-swift.property` property. \n\n #### Declaration\n\n Swift \n\n @available(watchOS, introduced: 6.0)\n @available(macOS, introduced: 10.15)\n @available(iOS, introduced: 13.0)\n @available(tvOS, introduced: 13.0)\n typealias Body = some View\n\n- `\n ``\n ``\n `\n\n ### [allContent](#/s:17GooglePlacesSwift15PlaceSearchViewV10allContentShyAA0deH0OGvpZ)\n\n `\n ` \n All [PlaceSearchContent](../Enums/PlaceSearchContent.html) types for the place search component. \n\n #### Declaration\n\n Swift \n\n @MainActor\n static let allContent: Set\u003c../Enums/PlaceSearchContent.html\u003e\n\n- `\n ``\n ``\n `\n\n ### [body](#/s:17GooglePlacesSwift15PlaceSearchViewV4bodyQrvp)\n\n `\n ` \n The content and behavior of the view.\n\n When you implement a custom view, you must implement a computed\n `body` property to provide the content for your view. Return a view\n that's composed of built-in views that SwiftUI provides, plus other\n composite views that you've already defined: \n\n struct MyView: View {\n var body: some View {\n Text(\"Hello, World!\")\n }\n }\n\n For more information about composing views and a view hierarchy,\n see \u003cdoc:Declaring-a-Custom-View\u003e. \n\n #### Declaration\n\n Swift \n\n @MainActor\n @preconcurrency\n var body: some View { get }\n\n- `\n ``\n ``\n `\n\n ### [init(orientation:request:configuration:)](#/s:17GooglePlacesSwift15PlaceSearchViewV11orientation7request13configurationAcA0dF11OrientationO_0C2UI7BindingVyAA0deF7RequestOGAA0dE13ConfigurationVtcfc)\n\n `\n ` \n Creates a list of place search results. \n\n #### Declaration\n\n Swift \n\n @MainActor\n init(orientation: ../Enums/PlaceViewOrientation.html = .vertical, request: Binding\u003c../Enums/PlaceSearchViewRequest.html\u003e, configuration: ../Structs/PlaceSearchConfiguration.html)\n\n #### Parameters\n\n |-----------------------|---------------------------------------------------------------------------------|\n | ` `*orientation*` ` | The orientation of the view. |\n | ` `*request*` ` | The request for the view, which is used when fetching the place search results. |\n | ` `*configuration*` ` | The configuration settings for the view. |\n\n #### Return Value\n\n A view that displays a list of place search results.\n- `\n ``\n ``\n `\n\n ### [onLoad(_:)](#/s:17GooglePlacesSwift15PlaceSearchViewV6onLoadyACySayAA0D0VGcF)\n\n `\n ` \n Adds a callback to be called when the place results are loaded. \n\n #### Declaration\n\n Swift \n\n @MainActor\n func onLoad(_ callback: @escaping ([../Structs/Place.html]) -\u003e Void) -\u003e PlaceSearchView\n\n #### Parameters\n\n |------------------|--------------------------------------------------------------|\n | ` `*callback*` ` | The callback to be called when the place results are loaded. |\n\n #### Return Value\n\n The PlaceSearchView with the callback added.\n- `\n ``\n ``\n `\n\n ### [onPlaceSelected(_:)](#/s:17GooglePlacesSwift15PlaceSearchViewV02onD8SelectedyACyAA0D0VcF)\n\n `\n ` \n Adds a callback to be called when a place is selected. \n\n #### Declaration\n\n Swift \n\n @MainActor\n func onPlaceSelected(_ callback: @escaping (../Structs/Place.html) -\u003e Void) -\u003e PlaceSearchView\n\n #### Parameters\n\n |------------------|-----------------------------------------------------|\n | ` `*callback*` ` | The callback to be called when a place is selected. |\n\n #### Return Value\n\n The PlaceSearchView with the callback added.\n- `\n ``\n ``\n `\n\n ### [onRequestError(_:)](#/s:17GooglePlacesSwift15PlaceSearchViewV14onRequestErroryACyAA0bI0OcF)\n\n `\n ` \n Adds a callback to be called when the place search request fails. \n\n #### Declaration\n\n Swift \n\n @MainActor\n func onRequestError(_ callback: @escaping (../Enums/PlacesError.html) -\u003e Void) -\u003e PlaceSearchView\n\n #### Parameters\n\n |------------------|--------------------------------------------------------|\n | ` `*callback*` ` | The callback to be called if the search request fails. |\n\n #### Return Value\n\n The PlaceSearchView with the callback added.\n- `\n ``\n ``\n `\n\n ### [standardContent](#/s:17GooglePlacesSwift15PlaceSearchViewV15standardContentShyAA0deH0OGvpZ)\n\n `\n ` \n A set of standard [PlaceSearchContent](../Enums/PlaceSearchContent.html) types for the place search component. \n\n #### Declaration\n\n Swift \n\n @MainActor\n static let standardContent: Set\u003c../Enums/PlaceSearchContent.html\u003e"]]