Classes

The following classes are available globally.

  • Class to add a key for the map. The key must be injected before a MapView can be used.

    • Example: “” func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { MapsDisplayService.apiKey = “MAP_KEY” […] return true }
    - Important: This is a Public Preview API. It may be changed or removed at any time.
    
    See more

    Declaration

    Swift

    final public class MapsDisplayService

TomTomCopyrightsService

  • Default implementation of CopyrightsService.

    See more

    Declaration

    Swift

    final public class TomTomCopyrightsService : CopyrightsService
  • Allows the user to configure the initial parameters of the map.

    MapOptions is used in conjunction with MapViewinitialization, i.e: When creating a MapView, it is possible to pass a MapOptions object to configure the MapView before it is showing on the screen, for example, creating a MapView object with the default TomTom style, and a dark style mode: let mapOptions = MapOptions(mapStyle: .defaultStyle, apiKey: "your-key", styleMode: .dark) let mapView = MapView(mapOptions: mapOptions)

    Creating a MapView without passing a MapOptions object, will result in the MapView being created using the deafult values. In such case, the API Key that will be used for the map will be taken from MapsDisplayService.apiKey.

    See more

    Declaration

    Swift

    public class MapOptions : NSObject

Layer

  • The Layer protocol that represents map layer.

    See more

    Declaration

    Swift

    public class Layer

Style

  • The Style protocol that represents the map style.

    See more

    Declaration

    Swift

    public final class Style

Circle

InnerPolygonOptions

Line

PolygonOverlay

  • A polygon overlay can be built by setting the outer area color and adding inner polygons. Only one inner polygon is supported, but the inner polygons can be nested. Example:

       let innerOptions = InnerPolygonOptions(fillColor: .red
                                          coordinates: coordinates)
    
       innerOptions.nestedPolygonOptions = InnerPolygonOptions(
           fillColor: UIColor.blue,
           coordinates: coordinates
       )
    
       let polygonOptions = PolygonOverlayOptions(outerColor: .green,
                                              innerPolygonOptions: innerOptions)
    
       try? mapView.map.addPolygonOverlay(options: polygonOptions)
    

    }

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public class PolygonOverlay : Annotation

PolygonOverlayOptions

Marker

Polygon

Route

  • A Route representation which can be added and displayed on the map.

    To show a Route on the map, call the TomTomMap.addRoute(RouteOptions) method. You can configure its shape and appearance with the RouteOptions class. Drawing a Route on the map requires a list with coordinates of the Route points.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public class Route

MapView

  • Use the MapView object to display the map in the view hierarchy.

    See more

    Declaration

    Swift

    @objc
    open class MapView : UIView

TomTomMap

  • The TomTomMap class serves as the foundational class, acting as the primary gateway for integrating a multitude of map-related features. It offers a rich set of functionalities enabling developer interaction with the map and customizing its behavior.

    TomTomMap can be accessed in several ways through the MapView class:

    • Through the property mapView.map.
    • By calling mapView.getMapAsync, i.e., mapView.getMapAsync { map in // do something with map }
    • By assigning mapView.onMapReadyCallback, i.e., mapView.onMapReadyCallback = { map in // do something with map }
    • By defining mapView(_:, onMapReady:) through the MapDelegate, i.e., func mapView(_: MapView, onMapReady map: TomTomMap) { // do something with the map } In most cases, the preferred way to access the map would be through the property mapView.map, but in some cases where the map should be ready first, such as when calling showVehicleRestrictions(vehicle:) the preferred way would be mapView.getMapAsync or mapView.onMapReadyCallback.
    See more

    Declaration

    Swift

    public class TomTomMap : AnnotationsActions, RouteActions, MapActions
    extension TomTomMap: CameraActions
    extension TomTomMap: RenderedFeatureActions
    extension TomTomMap: VehicleActions, LocationActions