public enum AutocompleteSegment

AutocompleteSegment represents an entity found within the autocomplete search term.

An entity can be a brand, a point of interest (POI) category, or plain text. Every case has a corresponding associated object. This enum is used in AutocompleteResult to describe the matched entities returned from the autocomplete search.

An example of handling segments:

let options = AutocompleteOptions(
    query: "mar",
    position: .AMSTERDAM,
    radius: Measurement(value: 100, unit: .kilometers),
    countries: ["NL"]
search.autocomplete(options: options) { result in
    if case let .success(response) = result {
        response.results.forEach { result in
            result.segments.forEach { segment in
                switch segment {
                case .brand(let brand):
                    print("Brand: \(")
                case .poiCategory(let category):
                    print("Category: \(")
                case .plainText(let text):
                    print("Text: \(text.plainText)")
                @unknown default:

 // Prints:
 //   Category: Market
 //   Brand: Marqt
 //   Category: Marina
 //   Brand: Marriott

  • Represents a matched brand entity.

    For example the query “BM” can return an autocomplete search result with the brand segment and the brand “BMW”.



    case brand(AutocompleteSegmentBrand)
  • Represents a matched POI category entity.

    For example, the query “Air” can return an autocomplete search result with the category segment and the category “Airport”.



    case poiCategory(AutocompleteSegmentPOICategory)
  • Represents a matched plain text entity.

    For example the query “Qwe” cannot be recognized as a brand or a category, so it can return an autocomplete search result with the plain text segment and the query “Qwe”.



    case plainText(AutocompleteSegmentPlainText)