TTAutocompleteQueryBuilder

Objective-C

@interface TTAutocompleteQueryBuilder : NSObject

Swift

class TTAutocompleteQueryBuilder : NSObject

TTAutocompleteQueryBuilder

  • Creates a builder object that can be used to build a query with the provided parameters.

    Declaration

    Objective-C

    + (TTAutocompleteQueryBuilder *_Nonnull)createWithTerm:(NSString *_Nonnull)term
                                              withLanguage:
                                                  (NSString *_Nonnull)language;

    Swift

    class func create(withTerm term: String, withLanguage language: String) -> TTAutocompleteQueryBuilder

    Parameters

    term

    language

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

    Declaration

    Objective-C

    - (TTAutocompleteQueryBuilder *_Nonnull)withLimit:(NSUInteger)limit;

    Swift

    func withLimit(_ limit: UInt) -> TTAutocompleteQueryBuilder

    Parameters

    limit

    The maximum number of Responses that will be returned.

  • The position where results should be biased. Supplying the position without a radius will only bias the search results to that area.

    Declaration

    Objective-C

    - (TTAutocompleteQueryBuilder *_Nonnull)withPosition:
        (CLLocationCoordinate2D)position;

    Swift

    func withPosition(_ position: CLLocationCoordinate2D) -> TTAutocompleteQueryBuilder

    Parameters

    position

    The position where results should be biased.

  • The position where results should be biased. The radius parameter is specified in meters. If radius and position are set, the results will be constrained to the defined area. If radius is not present or is set to 0, the results will not be constrained.

    Declaration

    Objective-C

    - (TTAutocompleteQueryBuilder *_Nonnull)withPosition:
                                                (CLLocationCoordinate2D)position
                                              withRadius:(NSUInteger)radius;

    Swift

    func withPosition(_ position: CLLocationCoordinate2D, withRadius radius: UInt) -> TTAutocompleteQueryBuilder

    Parameters

    position

    position The position where results should be biased.

    radius

    The search radius.

  • A comma-separated string of country codes (e.g., FR,ES). This will limit the search to the specified countries.

    Declaration

    Objective-C

    - (TTAutocompleteQueryBuilder *_Nonnull)withCountry:(NSString *_Nonnull)country;

    Swift

    func withCountry(_ country: String) -> TTAutocompleteQueryBuilder

    Parameters

    country

    A string with country codes.

  • Restricts the result space based on their segment types. A result is only included if at least one segment is of any of the indicated types. Note: In order to add several types call the method multiple times with different arguments.

    Declaration

    Objective-C

    - (TTAutocompleteQueryBuilder *_Nonnull)withResultType:(TTResultType)resultType;

    Swift

    func withResultType(_ resultType: TTResultType) -> TTAutocompleteQueryBuilder

    Parameters

    resultType

    A comma-separated list that consists of the types of segments.

  • Build method

    Declaration

    Objective-C

    - (TTAutocompleteQuery *_Nonnull)build;

    Swift

    func build() -> TTAutocompleteQuery