Suggestion Class Reference
- Last UpdatedMay 28, 2025
- 1 minute read
public class Suggestion
extension Suggestion: NativeBase
extension Suggestion: Hashable
Suggestion is meant to provide relevant suggestions to partial queries, like “restaur”, “starbu”, “eiffel”.
Represents a relevant response to user queries.
Suggestions (please check SuggestionType
) are either:
Place: SuggestionType.place
Query: SuggestionType.chain
or SuggestionType.category
With “Place” you get data for a concrete place in the world. With “Query” something to follow-up, a way to perform more focused search.
-
The localized title for the suggestion.
Declaration
Swift
public var title: String { get }
-
Type of the suggestion.
Declaration
Swift
public var type: SuggestionType { get }
-
The suggested place. Note: Available only for
SuggestionType.place
.Declaration
Swift
public var place: Place? { get }
-
The unique id of suggested item. It can be used to query further information. Note: For online search, suggestion of type
SuggestionType.place
will have Suggestion.id same as Place.id. Note: For offline search, only suggestion of typeSuggestionType.chain
, will have this property filled with identifier number of an associated chain. For example, the chain ID “8778” corresponds to the chain name “ABC Shop”. For other types,SuggestionType.place
andSuggestionType.category
this property will be null.Declaration
Swift
public var id: String? { get }
-
Direct URL for precise query. Note: Available only for
SuggestionType.chain
andSuggestionType.category
.Declaration
Swift
public var href: String? { get }
-
The text slices matching the input query.
Declaration
Swift
public func getHighlights() -> [HighlightType : [IndexRange]]
Return Value
Associated container where
HighlightType
is a key and list ofIndexRange
value.