SearchVisualization
public protocol SearchVisualization
Entry point for all methods related to the search visualization.
Instances of SearchVisualization
are created using create(search:map:)
.
You should call methods on these instances from the main thread only, otherwise an exception can occur.
To use a SearchVisualization
instance, first provide a route geometry and a SearchConfiguration
with the displayPOIsAlongRoute(geometry:configuration:completion:)
method.
You can then call clear()
to remove all the primitives that have been added to the map.
Additionally, you can add or remove tap observers for the TomTomSDKPOIVisualization/POI
s using the addTapObserver(_:)
and removeTapObserver(_:)
methods, respectively.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Displays Points of Interest (
TomTomSDKPOIVisualization/POI
s) along a specified route with a given configuration.Declaration
Swift
func displayPOIsAlongRoute( geometry: [CLLocationCoordinate2D], configuration: SearchConfiguration, completion: @escaping (Result<[TomTomSDKPOIVisualization.POI], Error>) -> () )
Parameters
geometry
An array of
CLLocationCoordinate2D
that defines the route geometry.configuration
The configuration for the
TomTomSDKPOIVisualization/POI
search.completion
A closure called upon completion. It returns a list of displayed
TomTomSDKPOIVisualization/POI
s on success, or an error on failure. -
Clears all
TomTomSDKPOIVisualization/POI
s on the map that were displayed withdisplayPOIsAlongRoute(geometry:)
Declaration
Swift
func clear()
-
Adds an observer to the list of tap observers.
This allows external entities to observe and respond to tap events on
TomTomSDKPOIVisualization/POI
s. When aTomTomSDKPOIVisualization/POI
is tapped, all registered observers are notified.Declaration
Swift
func addTapObserver(_ observer: POITapObserver)
Parameters
observer
An object that conforms to the
TomTomSDKPOIVisualization/POITapObserver
protocol. -
Removes an observer from the list of tap observers.
The specified observer no longer receives notifications of tap events on
TomTomSDKPOIVisualization/POI
s.Declaration
Swift
func removeTapObserver(_ observer: POITapObserver)
Parameters
observer
An object that conforms to the
TomTomSDKPOIVisualization/POITapObserver
protocol being removed.