POIVisualization

public protocol POIVisualization

A protocol that provides methods to visualize Points of Interest (POIs) on a map interface using the TomTomMap instance. Instances of POIVisualization are created using create(map:) You should call methods on these instances from the main thread only, otherwise an exception can occur. To use a POIVisualization instance, first provide a list of POI with the display(pois:) method. You can then call display(pois:) or clear() to remove the POIs that have been added to the map by POIVisualization.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Displays or updates the provided Points of Interest (POIs) on the map.

    For each POI in the provided array:

    • If it doesn’t already exist on the map, it is added.
    • If it does exist and has updated metadata, it is replaced with the new data.

    Declaration

    Swift

    func display(pois: [POI])

    Parameters

    pois

    An array of POI objects that represent the locations, metadata, and potential changes for the Points of Interest to be visualized or updated on the map.

  • Remove POIs from the map if they were added before with display(pois:).

    Declaration

    Swift

    func remove(pois: [POI])

    Parameters

    pois

    An array of POI objects to be removed from the map.

  • Removes all displayed Points of Interest (POIs) from the map.

    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 POIs. When a POI is tapped, all registered observers are notified. Observers are weakly referenced; ensure you maintain a strong reference to observers to prevent them from being deallocated prematurely.

    Declaration

    Swift

    func addTapObserver(_ observer: POITapObserver)

    Parameters

    observer

    An object that conforms to the POITapObserver protocol.

  • Removes an observer from the list of tap observers.

    The specified observer will no longer receive notifications of tap events on POIs.

    Declaration

    Swift

    func removeTapObserver(_ observer: POITapObserver)

    Parameters

    observer

    An object that conforms to the POITapObserver protocol to be removed.