GMSAutocompleteFetcher Class Reference

GMSAutocompleteFetcher Class Reference

Overview

GMSAutocompleteFetcher is a wrapper around the lower-level autocomplete APIs that encapsulates some of the complexity of requesting autocomplete predictions as the user is typing.

Calling sourceTextHasChanged will generally result in the provided delegate being called with autocomplete predictions for the queried text, with the following provisos:

  • The fetcher may not necessarily request predictions on every call of sourceTextHasChanged if several requests are made within a short amount of time.
  • The delegate will only be called with prediction results if those predictions are for the text supplied in the most recent call to sourceTextHasChanged.

Public Member Functions

(instancetype) - initWithBounds:filter:
 Initialize the fetcher.
(void) - provideSessionToken:
 Provide a GMSAutocompleteSessionToken for tracking the specific autocomplete query flow.
(void) - sourceTextHasChanged:
 Notify the fetcher that the source text to autocomplete has changed.

Properties

id
< GMSAutocompleteFetcherDelegate
delegate
 Delegate to be notified with autocomplete prediction results.
GMSCoordinateBounds * autocompleteBounds
 Bounds used to bias or restrict the autocomplete results depending on the value of autocompleteBoundsMode (can be nil).
GMSAutocompleteBoundsMode autocompleteBoundsMode
 How to treat the autocompleteBounds property.
GMSAutocompleteFilterautocompleteFilter
 Filter to apply to autocomplete suggestions (can be nil).

Member Function Documentation

- (instancetype) initWithBounds: (nullable GMSCoordinateBounds *)  bounds
filter: (nullable GMSAutocompleteFilter *)  filter 

Initialize the fetcher.

Parameters:
boundsThe bounds used to bias or restrict the results. Whether this biases or restricts is determined by the value of the autocompleteBoundsMode property. This parameter may be nil.
filterThe filter to apply to the results. This parameter may be nil.

Provide a GMSAutocompleteSessionToken for tracking the specific autocomplete query flow.

- (void) sourceTextHasChanged: (nullable NSString *)  text

Notify the fetcher that the source text to autocomplete has changed.

This method should only be called from the main thread. Calling this method from another thread will result in undefined behavior. Calls to GMSAutocompleteFetcherDelegate methods will also be called on the main thread.

This method is non-blocking.

Parameters:
textThe partial text to autocomplete.

Property Documentation

- (id<GMSAutocompleteFetcherDelegate>) delegate [read, write, assign]

Delegate to be notified with autocomplete prediction results.

- (GMSCoordinateBounds*) autocompleteBounds [read, write, assign]

Bounds used to bias or restrict the autocomplete results depending on the value of autocompleteBoundsMode (can be nil).

How to treat the autocompleteBounds property.

Defaults to kGMSAutocompleteBoundsModeBias.

Has no effect if autocompleteBounds is nil.

- (GMSAutocompleteFilter*) autocompleteFilter [read, write, assign]

Filter to apply to autocomplete suggestions (can be nil).

Send feedback about...