Map Display
Declaration
Swift
extension AggregatingMapMetricsMonitorService: MapMetricsMonitorService
extension AggregatingMapMetricsMonitorService: MapMetricsObserver
extension AggregatingMapMetricsMonitorService: ContinuousMapMetricsMonitorService
Base protocol for any Annotation
: polygon, line, circle, marker etc.
Declaration
Swift
public protocol Annotation
Base protocol for AnnotationOptions
Declaration
Swift
public protocol AnnotationOptions
A protocol that defines map annotation actions.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol AnnotationsActions
Annotation service error.
See moreDeclaration
Swift
public enum AnnotationServiceError : Error
extension AnnotationServiceError: LocalizedError
Cache configuration for caching both tiles and styles.
It provides control over the system memory and disk capacity used for caching, as well as the maximum cache duration for style resources
and a mapping of cache durations to corresponding request URL filters.
Unlike style caching, the tiles’ cache duration is handled by the server, utilizing the max-age
header.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public struct CacheConfiguration
extension CacheConfiguration: Equatable
A protocol that defines camera actions.
See moreDeclaration
Swift
public protocol CameraActions
A type that represents CameraProperties: position, zoom, tilt and rotation
See moreDeclaration
Swift
public struct CameraProperties
A type that represents camera tracking modes.
See moreDeclaration
Swift
public enum CameraTrackingMode : Equatable
The CameraUpdate
class specifies the map view’s camera position, zoom, tilt, rotation and more.
There are two ways to set a camera update:
Call
TomTomMap.applyCamera(_:, animationDuration:, completion:)
orTomTomMap.moveCamera(_:)
which sets the camera update with a corresponding animation for the former or no animation for the latter.Set it directly through the
MapView
, i.e.:mapView.cameraUpdate = CameraUpdate(position: .AMSTERDAM, zoom: 11)
.
Each method has its limitations:
- When calling
applyCamera(_:, animationDuration:, completion:)
andmoveCamera(_:)
through theTomTomMap
, there are certainCameraUpate
properties that can and cannot be used in conjunction with others:
init(position:zoom:tilt:rotation:positionMarkerVerticalOffset:scale:fieldOfView:)
:
zoom
- cannot be used together withscale
.scale
- cannot be used together withzoom
.
init(zoomBy:zoomIn:zoomOut:tiltBy:rotateBy:moveBy:fieldOfViewChangeBy:)
:
zoomBy
- cannot be used together withzoomIn
orzoomOut
.zoomIn
- cannot be used together withzoomOut
orzoomBy
.zoomOut
- cannot be used together withzoomIn
orzoomBy
.moveBy
- cannot be used together with any of the other properties.- When setting directly the
cameraUpdate
field through theMapView
, no animation is applied and only these specific properties can be set:
- When setting directly the
position
.zoom
- cannot be used together withscale
.tilt
.rotation
.scale
- cannot be used together withzoom
.fieldOfView
.moveBy
- cannot be used together with any of the other properties.
Declaration
Swift
public struct CameraUpdate : Equatable
Represents the circle on the map.
See moreDeclaration
Swift
public class Circle : Annotation
A type that represents circle options.
See moreDeclaration
Swift
public struct CircleOptions : AnnotationOptions, Equatable
View Model for CompassButton.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public class CompassButtonViewModel
The camera configuration for a given distance to the next instruction on the route. Intermediate values are obtained by linear interpolation between the corresponding points.
See moreDeclaration
Swift
public struct ControlPoint : Equatable
Coordinate along line.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public struct CoordinateAlongLine : Equatable
The coordinate region.
See moreDeclaration
Swift
public struct CoordinateBounds
CopyrightsServiceProtocol defines a method used to obtain the copyright informations.
See moreDeclaration
Swift
public protocol CopyrightsService
Provides control over current location button, use it to manage visibility and the icon of it.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public class CurrentLocationButtonViewModel
Declaration
Swift
extension DaichiRouteService: MapInteractionObserver
Dash length units.
Declaration
Swift
public typealias DashLengthUnits = Double
Declaration
Swift
extension DefaultLocationService: LocationUpdateObserver
extension DefaultLocationService: CLLocationManagerDelegate
Declaration
Swift
extension DefaultMapMetricsMonitorService: MapMetricsMonitorService
extension DefaultMapMetricsMonitorService: MapMetricsObserver
Declaration
Swift
extension DefaultRouteService: MapInteractionObserver
Declaration
Swift
extension DoubleTapAndPanGestureContainer: UIGestureRecognizerDelegate
Declaration
Swift
extension DoubleTapGestureContainer: UIGestureRecognizerDelegate
A type that represents a set of coordinates and the padding around them.
See moreDeclaration
Swift
public struct FitToCoordinatesOptions : Equatable
The configuration for follow camera operators.
See moreDeclaration
Swift
public struct FollowCameraOperatorConfig : Equatable
Declaration
Swift
extension GeoJSONInnerPolygonOptions: Equatable
Declaration
Swift
extension GeoJSONMarkerOptions: Equatable
Declaration
Swift
extension GeoJSONRouteInstruction: Equatable
Declaration
Swift
extension GestureMessage: Equatable
Defines the gesture state.
See moreDeclaration
Swift
public enum GestureState
An OptionSet that defines available gestures for ExclusiveGestureManager.
Declaration
Swift
public struct GestureType : OptionSet, Hashable
Options that defines inner polygon. Can be used with PolygonOverlayOptions
.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public class InnerPolygonOptions : AnnotationOptions
The Layer
protocol that represents map layer.
Declaration
Swift
public class Layer
Type of this layer.
See moreDeclaration
Swift
public enum LayerType
Represents the line on the map.
See moreDeclaration
Swift
public class Line : Annotation
Line cap placement
See moreDeclaration
Swift
public enum LineCapPlacement
Line cap type.
See moreDeclaration
Swift
public enum LineCapType
Line join type.
See moreDeclaration
Swift
public enum LineJoinType
Line options.
See moreDeclaration
Swift
public struct LineOptions : AnnotationOptions, Equatable
Line outline style.
See moreDeclaration
Swift
public enum LineOutlineStyle
Line pattern.
See moreDeclaration
Swift
public struct LinePattern : Equatable
Line pattern repeat.
See moreDeclaration
Swift
public enum LinePatternRepeat
Line pattern type.
See moreDeclaration
Swift
public enum LinePatternType
Line unit.
See moreDeclaration
Swift
public enum LineUnit
Type to control location features.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol LocationActions
Types of the location marker visualization.
See moreDeclaration
Swift
public enum LocationIndicator : Equatable
LogoViewModel
is responsible for managing the visibility state of a logo within a user interface.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public final class LogoViewModel
Declaration
Swift
extension LongPressGestureContainer: UIGestureRecognizerDelegate
MapActions
defines a set of methods closely connected to the map.
Declaration
Swift
public protocol MapActions
Provides methods to fetch copyrights and caption.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
final public class MapCopyrights
The methods that an object adopts to manage callout views for a MapView.
See moreDeclaration
Swift
public protocol MapDataSource : AnyObject
Methods for managing map interactions and events.
See moreDeclaration
Swift
public protocol MapDelegate : AnyObject
The MapDisplayDataProvider
protocol that can be used to add custom data providers.
FileOutput
- Default logger output - prints logs using Swift.print
Important
This API has to be implemented in a thread-safe way.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol MapDisplayDataProvider
A cancellable task of a data provider which gathers the resource.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol MapDisplayDataRequestToken
MapGestureDisableOption
An option set defining the map gestures to be disabled.
Declaration
Swift
public enum MapGestureDisableOption
Allows the user to configure the initial parameters of the map.
MapOptions
is used in conjunction with MapView
initialization, 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
.
Declaration
Swift
public class MapOptions : NSObject
MapMetalRendererFrameCaptureDelegate
exposes possibility to get currently drawn frame as a texture.
Using this delegate may have impact of performance rendering.
Declaration
Swift
public protocol MapRendererFrameCaptureDelegate : AnyObject
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
Protobuf-encoded map tile data. The format of the tile data is formally described using the protobuf schema available on: https://developer.tomtom.com/map-display-api/documentation/vector/content#schema-data
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public struct MapTile
Describes options to request map tiles for given zoom and coordinate.
Detailed explanation of values can be found on: https://developer.tomtom.com/map-display-api/documentation/zoom-levels-and-tile-grid
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public struct MapTileOptions : Equatable
The MapView
object to wrap the underlying map renderer.
It contains the map created by the renderer in the view hierarchy and provides UI and view life-cycle functionalities. The view can be created programmatically, via xib or storyboards.
For example, displaying a simple MapView
programmatically using a constraints-based layout:
Initialization:
lazy var mapView: MapView = {
let mapOptions = MapOptions(mapStyle: .defaultStyle, apiKey: "your-key")
let mapView = MapView(mapOptions: mapOptions)
return mapView
}()
Layout:
mapView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(mapView)
NSLayoutConstraint.activate([
mapView.widthAnchor.constraint(equalTo: view.widthAnchor),
mapView.heightAnchor.constraint(equalTo: view.heightAnchor),
])
Setting up the receival of life-cycle events and updates, as well as setting the initial zoom and position of the map view:
mapView.delegate = self
mapView.cameraUpdate = .init(position: .AMSTERDAM, zoom: 13)
There will also be a need to conform your UIViewController
to MapViewDelegate
and implement the required methods.
Declaration
Swift
@objc
@MainActor
open class MapView : UIView
Enumeration of TomTomMap View errors.
See moreDeclaration
Swift
public enum MapViewError : LocalizedError
Represents the marker on the map.
See moreDeclaration
Swift
public class Marker : Annotation
Options that define label inside marker. Can be used with MarkerOptions
.
Declaration
Swift
public struct MarkerLabelOptions : AnnotationOptions, Equatable
A type that represents marker options.
See moreDeclaration
Swift
public struct MarkerOptions : AnnotationOptions, Equatable
The Metadata
is used to carry extra information.
Declaration
Swift
public struct Metadata
Declaration
Swift
extension MichiCameraClient: NKTCameraOperatorDelegate
Declaration
Swift
extension MichiLocationClient: NKTPositionMarkerClickedDelegate
The offset of the line to be created.
Declaration
Swift
public typealias OffsetUnits = Double
The OnDiskCachePolicy
sets rules for caching: time interval of storing the cache, maximum cache size, etc.
Declaration
Swift
public enum OnDiskCachePolicy : Equatable
The cache which is being used while fetching map tiles.
See moreDeclaration
Swift
public enum OnlineCachePolicy
extension OnlineCachePolicy: Equatable
Responsible for creating instances of MapDisplayDataProvider
for handling online map tile requests.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum OnlineTileDataProviderFactory
Outline width scene.
See moreDeclaration
Swift
public struct OutlineWidthScene : Equatable
Declaration
Swift
extension PanGestureContainer: UIGestureRecognizerDelegate
Pattern begin offset scene.
See moreDeclaration
Swift
public struct PatternBeginOffsetScene : Equatable
Pattern length scene.
See moreDeclaration
Swift
public struct PatternLengthScene : Equatable
Declaration
Swift
extension PinchGestureContainer: UIGestureRecognizerDelegate
Represents the polygon on the map.
See moreDeclaration
Swift
public class Polygon : Annotation
Polygon options.
See moreDeclaration
Swift
public struct PolygonOptions : AnnotationOptions, Equatable
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.Declaration
Swift
public class PolygonOverlay : Annotation
Options for creating a PolygonOverlay
.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public class PolygonOverlayOptions : AnnotationOptions
Defines size for chevron or pointer for particular zoom level.
See moreDeclaration
Swift
public struct PositionMarkerSize
extension PositionMarkerSize: Equatable
RenderedFeature class
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public struct RenderedFeature
Rendered Feature Actions protocol.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol RenderedFeatureActions
Rendered features query.
See moreDeclaration
Swift
public struct RenderedFeatureQueryOptions
Reserve coordinate.
See moreDeclaration
Swift
public struct ReserveCoordinate : Equatable
Declaration
Swift
extension RotateGestureContainer: UIGestureRecognizerDelegate
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.
Declaration
Swift
public class Route
Protocol allowing management of the route representation on the map.
See moreDeclaration
Swift
public protocol RouteActions
RouteDelegate.
See moreDeclaration
Swift
public protocol RouteDelegate : AnyObject
Enumeration of route errors.
See moreDeclaration
Swift
public enum RouteError : LocalizedError
Route instruction.
See moreDeclaration
Swift
public struct RouteInstruction
Class that contains configuration of the route that will be drawn on the map.
Example:
let routeOption: RouteOptions = RouteOptions(coordinates: route.geometry)
guard let mapRoute = try? self.mapView.map.addRoute(routeOption) else { return }
See more
Declaration
Swift
public struct RouteOptions
A model that represents a part of the road under some special conditions, i.e., a tunnel or a non-drivable road, with a respective range.
This model describes these road segments, and then passes these segments to RouteOptions
as part of the route’s configuration that is drawn on the map.
Declaration
Swift
public struct RouteSection
Defines the properties for scale view. Whenever the map is zoomed in or out, the scale appears and is visible until there are no interactions with the map for at least 5 seconds. The scale view also disappears when the map is tilted or when the scale is out of range. Range for metric measurement system: 10m-1000km Range for imperial measurement system: 30ft-600mi
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public class ScaleViewModel
Scene color.
See moreDeclaration
Swift
public struct SceneColor : Equatable
Scene level where the specified color should be used.
Declaration
Swift
public typealias SceneLevel = Double
The SourceCollection
See moreDeclaration
Swift
public struct SourceCollection
This class provides a container for tiles sources information and map layers.
See moreDeclaration
Swift
public final class Style
Holder struct for main and dark version of the style definition.
If darkStyle
is not provided, setting TomTomMap.styleMode
has no effect.
Declaration
Swift
public struct StyleContainer
extension StyleContainer: Equatable
The map style definition. For style file format see map style specification. Style Specification is a formal definition of all properties that define the map’s appearance.
See moreDeclaration
Swift
public enum StyleDefinition
extension StyleDefinition: Equatable
Declaration
Swift
extension StyleFetcherError: Equatable
extension StyleFetcherError: LocalizedError
Defines the map styles available to the user.
See moreDeclaration
Swift
public enum StyleMode
Declaration
Swift
extension TapGestureContainer: UIGestureRecognizerDelegate
Text anchoring
See moreDeclaration
Swift
public enum TextAnchoring
Type that represents texture options.
See moreDeclaration
Swift
public struct TextureOptions : Equatable
Tile source definition. Details can be found: https://github.com/mapbox/tilejson-spec
Declaration
Swift
public struct TilesDefinition
Declaration
Swift
extension TiltGestureContainer: UIGestureRecognizerDelegate
Default implementation of CopyrightsService
.
Declaration
Swift
final public class TomTomCopyrightsService : CopyrightsService
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 theMapDelegate
, 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 propertymapView.map
, but in some cases where the map should be ready first, such as when callingshowVehicleRestrictions(vehicle:)
the preferred way would bemapView.getMapAsync
ormapView.onMapReadyCallback
.
Declaration
Swift
public class TomTomMap : AnnotationsActions, RouteActions, MapActions
extension TomTomMap: CameraActions
extension TomTomMap: RenderedFeatureActions
extension TomTomMap: VehicleActions, LocationActions
The traffic category icon.
See moreDeclaration
Swift
public enum TrafficIconCategory
Represents traffic incident details.
See moreDeclaration
Swift
public struct TrafficIncident
The traffic magnitude.
See moreDeclaration
Swift
public enum TrafficMagnitude
Declaration
Swift
extension TwoFingerTapGestureContainer: UIGestureRecognizerDelegate
Defines available actions according to vehicle restriction feature.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol VehicleActions
Defines map visible region as CLLocationCoordinate2D
coordinates.
Declaration
Swift
public struct VisibleRegion
Width scene.
See moreDeclaration
Swift
public struct WidthScene : Equatable
ZoomControlsViewModel
serves as the view model layer for managing the zoom controls within a map interface.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public final class ZoomControlsViewModel