CancellableSearch
public protocol CancellableSearch
Defines a common interface to provide search functionality with additional cancellation support.
Important
This is a Public Preview API. It may be changed or removed at any time.-
This method provides the capability to search places and POIs meeting various criteria.
Declaration
Swift
@discardableResult func search(options: SearchOptions, completion: @escaping (Result<SearchResponse, Error>) -> ()) -> Cancellable
Parameters
options
The
SearchOptions
structure to limit the results.completion
The completion closure is called after the request response is processed. If no errors occurred,
SearchResponse
contains an array of search results and summary information. If cancellation is triggered, the completion returns a cancellation error. Sometimes, the completion may return with other work before acknowledging the cancellation.Return Value
a
Cancellable
instance that provides control for request cancellation. -
The Autocomplete API enables you to make a more meaningful Search API call by recognizing entities inside an input query and offering them as query terms.
Declaration
Swift
@discardableResult func autocomplete( options: AutocompleteOptions, completion: @escaping (Result<AutocompleteResponse, Error>) -> () ) -> Cancellable
Parameters
options
The
AutocompleteOptions
structure to limit the results.completion
The completion closure is called after the response to the request is processed. If no errors occurred,
AutocompleteResponse
contains proposed autocomplete elements, that can be used to implement an input field with the autocomplete feature. If cancellation is triggered, the completion returns a cancellation error. Sometimes, the completion may return with other work before acknowledging the cancellation.Return Value
a
Cancellable
instance that provides control for request cancellation. -
This method provides a full list of POI categories and subcategories together with their translations and synonyms. Additional POI category parameters like language can be considered using the
POICategoryOptions
.Declaration
Swift
@discardableResult func requestPOICategories( options: POICategoryOptions, completion: @escaping (Result<POICategoryResponse, Error>) -> () ) -> Cancellable
Parameters
options
The
POICategoryOptions
structure to limit the results.completion
The completion closure is called after the response to the request is processed. If no errors occurred,
POICategoryResponse
contains an array of categories and subcategories together with their translations and synonyms. If cancellation is triggered, the completion returns a cancellation error. Sometimes, the completion may return with other work before acknowledging the cancellation.Return Value
a
Cancellable
instance that provides control for request cancellation. -
Provides detailed information about a POI based on its identifier (entityId).
Declaration
Swift
@discardableResult func requestPOIDetails( options: POIDetailsOptions, completion: @escaping (Result<TomTomSDKSearch.POIDetailsResponse, Error>) -> () ) -> Cancellable
Parameters
options
Describes what POI Details data to request.
completion
The completion closure is called after the response to the request has been processed. If no errors occurred,
PoiDetailsResponse
contains the requested search result with POI info If cancellation is triggered, the completion returns a cancellation error. Sometimes, the completion may return with other work before acknowledging the cancellation.Return Value
a
Cancellable
instance that provides control for request cancellation. -
The Geometry Data API returns sets of coordinates that represent the outline of a city, country, or land area. The method supports batch requests of up to 20 identifiers.
Declaration
Swift
@discardableResult func requestGeometryData( options: GeometryDataOptions, completion: @escaping (Result<GeometryDataResponse, Error>) -> () ) -> Cancellable
Parameters
options
Define geometries to request.
completion
Parameter completion: The completion closure is called after the response to the request is processed. If no errors occurred,
GeometryDataResponse
contains an array of geometries data structure. If cancellation is triggered, the completion returns a cancellation error. Sometimes, the completion may return with other work before acknowledging the cancellation.Return Value
a
Cancellable
instance that provides control for request cancellation. -
Asynchronously sends a feedback event for the search.
Declaration
Swift
@discardableResult func sendFeedback(feedbackEvent: FeedbackEvent, completion: ((Error?) -> ())?) -> Cancellable
Parameters
feedbackEvent
The feedback event.
completion
If an error occurred,
completion
is called with error. If cancellation is triggered, the completion returns a cancellation error. Sometimes, the completion may return with other work before acknowledging the cancellation.Return Value
a
Cancellable
instance that provides control for request cancellation.