GooglePlacesSwift Framework Reference

View

extensionView
  • A modifier that provides an autocomplete component for the user to select a place.

    Whenshow is set to true, the user will be brought to a fullscreen view where they can selecta place. As the user types, the component returns suggestions for places such as businesses,addresses, and points of interest. When the user selects a place, the component calls theonSelection handler with the selected place, and closes the fullscreen view.

    Declaration

    Swift

    @MainActorfuncbasicPlaceAutocomplete(filter:AutocompleteFilter?=nil,uiCustomization:AutocompleteUICustomization=AutocompleteUICustomization(),initialQuery:String="",show:Binding<Bool>,onSelection:@escaping(Place)->Void,onError:@escaping(PlacesError)->Void)->someView

    Parameters

    filter

    The filter to apply to the autocomplete requests from the component.

    uiCustomization

    The UI customization to apply to the component.

    initialQuery

    The initial query to use for the component.

    show

    The binding for whether the component is shown.

    onSelection

    The closure to run when a place is selected.

    onError

    The closure to run when an error occurs.

    Return Value

    A modified view that displays the component whenshow is true.

  • A modifier that provides an autocomplete component for the user to select a place.

    Whenshow is set to true, the user will be brought to a fullscreen view where they can selecta place. As the user types, the component returns suggestions for places such as businesses,addresses, and points of interest. When the user selects a place, the component calls theonSelection handler with the selected place, and closes the fullscreen view.

    Declaration

    Swift

    @MainActorfuncplaceAutocomplete(filter:AutocompleteFilter?=nil,uiCustomization:AutocompleteUICustomization=AutocompleteUICustomization(),initialQuery:String="",sessionToken:AutocompleteSessionToken?=nil,show:Binding<Bool>,onSelection:@escaping(AutocompletePlaceSuggestion,AutocompleteSessionToken)->Void,onError:@escaping(PlacesError)->Void)->someView

    Parameters

    filter

    The filter to apply to the autocomplete requests from the component.

    uiCustomization

    The UI customization to apply to the component.

    initialQuery

    The initial query to use for the component.

    sessionToken

    TheAutocompleteSessionToken to associate requests with a billing session.A unique session token should be provided each time the component is shown. If no sessiontoken is provided, one will be created internally and returned in theonSelection handler.

    show

    The binding for whether the component is shown.

    onSelection

    The closure to run when a place is selected.

    onError

    The closure to run when an error occurs.

    Return Value

    A modified view that displays the component whenshow is true.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-02 UTC.