AutocompleteQueryBuilder

public class AutocompleteQueryBuilder

Autocomplete Search Query Builder.

Important

This is a Public Preview API. It may be changed or removed at any time.

Lifecycle

  • Builder init method.

    Declaration

    Swift

    public init(query: String, forLanguage: String)

    Parameters

    query

    Query string.

    forLanguage

    Language in which autocomplete results should be returned. One of the TomTom supported IETF language tags.

Public

  • When position is used on its own, results nearer the location will be boosted. When used in combination with radius, results will be constrained to the defined area.

    Declaration

    Swift

    public func with(position: CLLocationCoordinate2D) -> Self

    Parameters

    position

    position in ‘CLLocationCoordinate2D’.

    Return Value

    AutocompleteQueryBuilder object.

  • If radius and position are set, the results will be constrained to the defined area.

    Declaration

    Swift

    public func with(radius: Int) -> Self

    Parameters

    radius

    A radius in meters.

    Return Value

    AutocompleteQueryBuilder object.

  • Maximum number of autocomplete results that will be returned. Default value: 5. Maximum value: 10.

    Declaration

    Swift

    public func with(limit: Int) -> Self

    Parameters

    limit

    The limit of autocomplete results that will be returned.

    Return Value

    AutocompleteQueryBuilder object.

  • This will limit the autocomplete results to the specified countries.

    Declaration

    Swift

    public func with(countrySet: [String]) -> Self

    Parameters

    countrySet

    An array of country codes (e.g., [“FR”,“ES”]).

    Return Value

    AutocompleteQueryBuilder object.

  • Restricts the result space based on their segment types.

    Declaration

    Swift

    public func with(resultSet: [String]) -> Self

    Parameters

    resultSet

    An array of the types of segments.

    Return Value

    AutocompleteQueryBuilder object.

  • Declaration

    Swift

    public func build() -> AutocompleteQuery

    Return Value

    AutocompleteRequest object with parameters.