GooglePlacesSwift Framework Reference

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
  • All PlaceSearchContent types for the place search component.

    Declaration

    Swift

    @MainActor
    static let allContent: Set<PlaceSearchContent>
  • 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.

    Declaration

    Swift

    @MainActor
    init(orientation: PlaceViewOrientation = .vertical, request: Binding<PlaceSearchViewRequest>, configuration: PlaceSearchConfiguration)

    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.

  • A set of standard PlaceSearchContent types for the place search component.

    Declaration

    Swift

    @MainActor
    static let standardContent: Set<PlaceSearchContent>