TomTomMap
public class TomTomMap : AnnotationsActions, RouteActions, MapActions
extension TomTomMap: CameraActions
extension TomTomMap: RenderedFeatureActions
extension TomTomMap: VehicleActions, LocationActions
TomTomMap aggregates core map functionalities
-
The object that acts as the delegate of the
TomTomMap.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public weak var delegate: MapDelegate? -
The object that acts as the data source of the
TomTomMap.Declaration
Swift
public weak var dataSource: MapDataSource? -
The language to be used for labels returned in the response. It should be one of the supported IETF language code tags described here or one of the custom language tags. When data in a specified language is not available for a specific label, the default language is used. Default value: NGT (Neutral Ground Truth)
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var language: Locale { get set } -
Defines the map styles available to the user.
main: By default this is the TomTom light style.dark: By default this is the TomTom dark style. WhenMapOptions.mapStyle.darkStyleis not set, settingmap.styleMode = .darkwill have no effect.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var styleMode: StyleMode { get set } -
An
Arraydefining the map gestures to be disabled.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var disabledGestures: [MapGestureDisableOption] { get set } -
A container for main and dark version of the
StyleDefinition. IfdarkStyleis not provided, settingTomTomMap.styleModetodarkhas no effect.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var styleContainer: StyleContainer { get set } -
A
Boolvalue indicating whether marker fading is allowed or not. By default this value isfalse.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var isMarkersFadingEnabled: Bool { get set } -
A
Boolvalue indicating whether marker shrinking is allowed or not. By default this value isfalse.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var isMarkersShrinkingEnabled: Bool { get set } -
Sets the exclusive gestures on the map by specifying the
gesturethat has a higher priority than theblockedGestures.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func setExclusiveGestures(gesture: GestureType, blockedGestures: [GestureType])Parameters
gestureAn instance of
GestureTypedefining the gesture type to be set.blockedGesturesInstances of
GestureTypedefining the gestures with lower priority than thegesture. -
Adds a marker to the map using the provided
MarkerOptions.Throws
An error of typeAnnotationServiceErrorif the marker could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addMarker(options: MarkerOptions) throws -> MarkerParameters
optionsAn instance of
MarkerOptionsdefining the attributes of the marker to be added.Return Value
An instance of
Markerrepresenting the marker that was added. -
Adds a line to the map using the given
LineOptions.Throws
An error of typeAnnotationServiceErrorif the line could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addLine(options: LineOptions) throws -> LineParameters
optionsAn instance of
LineOptionsdefining the attributes of the line to be added.Return Value
An instance of
Linerepresenting the line that was added. -
Adds a polygon to the map using the given
PolygonOptions.Throws
An error of typeAnnotationServiceErrorif the polygon could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addPolygon(options: PolygonOptions) throws -> PolygonParameters
optionsAn instance of
PolygonOptionsdefining the attributes of the polygon to be added.Return Value
An instance of
Polygonrepresenting the polygon that was added. -
Adds a polygon overlay to the map using the given
PolygonOverlayOptions.Throws
An error of typeAnnotationServiceErrorif the polygon overlay could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addPolygonOverlay(options: PolygonOverlayOptions) throws -> PolygonOverlayParameters
optionsAn instance of
PolygonOverlayOptionsdefining the attributes of the polygon overlay to be added.Return Value
An instance of
PolygonOverlayrepresenting the polygon overlay that was added. -
Removes an annotation from the map with the given
Annotation.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func remove(annotation: Annotation)Parameters
annotationAn instance of
Annotationdefining the annotation to be removed. -
Adds a route to the map using the given
RouteOptions.Throws
An error of typeRouteErrorif the route could not be added.Declaration
Swift
public func addRoute(_ options: RouteOptions) throws -> RouteParameters
optionsAn instance of
RouteOptionsdefining the attributes of the route to be added.Return Value
An instance of
Routerepresenting the route that was added. -
Removes annotations from the map with the given tag.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func removeAnnotations(tag: String)Parameters
tagAn instance of
Stringdefining the annotation to be removed. -
Zooms to the current markers on the map with the given tag to fit them all on the screen with the given margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers(marginPx: UInt, tag: String)Parameters
marginPxPadding between coordinates and camera borders.
tagTag to find current markers.
-
Zooms to the current markers on the map with the given tag to fit them all on the screen with a 0px margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers(tag: String)Parameters
tagTag to find current markers.
-
Remove all route objects from the map.
Declaration
Swift
public func removeRoutes() -
Adds a circle to the map using the given
CircleOptions.Throws
An error of typeAnnotationServiceErrorif the circle could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addCircle(options: CircleOptions) throws -> CircleParameters
optionsAn instance of
CircleOptionsdefining the attributes of the circle to be added.Return Value
An instance of
Circlerepresenting the circle that was added. -
Remove all annotations from the map regardless of tags.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func removeAnnotations() -
Zooms to the all markers on the map regardless of tag to fit them all on the screen with a 0px margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers() -
Zooms to the all markers on the map regardless of tag to fit them all on the screen with the given margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers(marginPx: UInt)Parameters
marginPxPadding between coordinates and camera borders.
-
Sets the marker distance fading range.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func setMarkerDistanceFadingRange(range: ClosedRange<Measurement<UnitLength>>)Parameters
rangeMarker distance fading range.
-
Sets the marker distance shrinking range.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func setMarkerDistanceShrinkingRange(range: ClosedRange<Measurement<UnitLength>>)Parameters
rangeMarker distance shrinking range.
-
Returns an instance of
CLLocationCoordinate2Dfrom the givenCGPoint.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func coordinateForPoint(point: CGPoint) -> CLLocationCoordinate2D?Parameters
pointAn instance of
CGPointrepresenting the point on the map.Return Value
An instance of
CLLocationCoordinate2Drepresenting the location on the map. -
Returns an instance of
CGPointfrom the givenCLLocationCoordinate2D.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func pointForCoordinate(coordinate: CLLocationCoordinate2D) -> CGPoint?Parameters
coordinateAn instance of
CLLocationCoordinate2Drepresenting the location on the map.Return Value
An instance of
CGPointrepresenting the point on the map. -
Zooms to all current
Routes with the given padding.Declaration
Swift
public func zoomToRoutes(padding: UInt)Parameters
paddingPadding between coordinates and camera borders.
-
Selects an annotation identified by the given
Annotation. Selecting an annotation delegates a call toMapDelegateandMapDataSource.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func select(annotation: Annotation)Parameters
annotationAn instance of
Annotationdefining the annotation to be selected. -
Deselects an annotation identified by the given
Annotation.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func deselect(annotation: Annotation)Parameters
annotationAn instance of
Annotationdefining the annotation to be deselected. -
Takes a snapshot of the map and return a
UIImage.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func snapshot() -> UIImageReturn Value
An instance of
UIImagerepresenting the snapshot of the map. -
Takes a snapshot of the map without the given
UIViews and return aUIImage.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func snapshotWithoutViews(views: [UIView]) -> UIImageParameters
viewsInstances of
UIViewto be excluded.Return Value
An instance of
UIImagerepresenting the snapshot of the map. -
Fetches an
ArrayofLayers based on the given regex pattern. The regex is applied to theLayer.idproperty.- Example:
let roads = NSRegularExpression(pattern: ".*[rR]oad.*", options: [])) mapView.map.layersForRegexp(pattern: roads)
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func layersForRegexp(pattern: NSRegularExpression) -> [Layer]Parameters
patternRegex pattern.
Return Value
Instances of fetched
Layer. - Example:
-
Show traffic layers on the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func showTraffic() -
Hide traffic layers from the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func hideTraffic() -
Show traffic incidents layers on the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func showTrafficIncidents() -
Hide traffic incidents layers from the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func hideTrafficIncidents() -
Register a
TrafficIncidentObserverto be notified about traffic incidents clicks.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func registerTrafficIncidentObserver(_ observer: TrafficIncidentObserver)Parameters
observerAn instances of
TrafficIncidentObserverto be notified. -
Show hillshading layers on the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func showHillshading() -
Hide hillshading layers from the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func hideHillshading()
-
Returns visible region of the map.
Declaration
Swift
public var visibleRegion: VisibleRegion { get } -
Returns current camera properties.
Declaration
Swift
public var cameraProperties: CameraProperties { get } -
Represents how the camera follows the current position. There are five available tracking modes:
- none: No camera tracking.
- follow: Camera follows the current position.
- followRoute: Camera follows the current position and heading, while adjusting tilt and scale to best present the route and its guidance instructions.
- followDirection: Camera follows the current position and heading.
- routeOverview: The operator tries to fit the routes in the current view, by changing the camera zoom and look-at parameters. It constantly adjusts these parameters to keep the remaining part of the route(s) in view. Tilt and heading parameters are set to 0 in this camera mode.
Declaration
Swift
public var cameraTrackingMode: CameraTrackingMode { get set } -
Applies a
CameraUpdatewith with the givendurationfor the animation.Declaration
Swift
public func applyCamera( _ update: CameraUpdate, animationDuration: TimeInterval, completion: ((Bool) -> ())? ) -
Applies a
CameraUpdatewith no animation.Declaration
Swift
public func moveCamera(_ update: CameraUpdate) -
Stops the current ongoing
CameraUpdateanimation.Declaration
Swift
public func stopAnimation()
-
Fetches all map features, such as annotations and map layers at the given
CLLocationCoordinate2D.Declaration
Swift
public func mapFeatures(coordinate: CLLocationCoordinate2D) -> [RenderedFeature] -
Fetches all map features, such as annotations and map layers at the given
CLLocationCoordinate2Dfiltered by the givenRenderedFeatureQueryOptions.Declaration
Swift
public func mapFeatures(coordinate: CLLocationCoordinate2D, options: RenderedFeatureQueryOptions) -> [RenderedFeature]Parameters
coordinateThe given
CLLocationCoordinate2Dto fetch the map features from.optionsThe
RenderedFeatureQueryOptionsfilter to return specific rendered features at the given coordinate.Return Value
An
ArrayofRenderedFeaturethat was found at the given coordinate filtered by the givenRenderedFeatureQueryOptions. -
Fetches all map features, such as annotations and map layers within the given
CoordinateBounds.Declaration
Swift
public func mapFeatures(coordinateBounds: CoordinateBounds) -> [RenderedFeature] -
Fetches all map features, such as annotations and map layers within the given
CoordinateBoundsfiltered by the givenRenderedFeatureQueryOptions.Declaration
Swift
public func mapFeatures(coordinateBounds: CoordinateBounds, options: RenderedFeatureQueryOptions) -> [RenderedFeature]Parameters
coordinateBoundsThe given
CoordinateBoundsto fetch the map features from.optionsThe
RenderedFeatureQueryOptionsfilter to return specific rendered features within the given coordinate bounds.Return Value
An
ArrayofRenderedFeaturethat was found within the given coordinate bounds filtered by the givenRenderedFeatureQueryOptions.
-
Provides location services, such as:
start(): Starts the location engine. It might be called from a private queue.stop(): Stops the location engine. It might be called from a private queue.location: The last location received. It will be nil until a location has been received.addObserver: Add an observer to the location engine.removeObserver: Remove an observer from the location engine.Declaration
Swift
public var locationProvider: LocationProvider { get set } -
Validates the location and the source that provides the location.
Declaration
Swift
public var locationValidator: LocationValidator { get set } -
Type of the location marker’s visualization. Can be used to change the location marker’s scale and or image.
Declaration
Swift
public var locationIndicatorType: LocationIndicator { get set } -
Starts the location engine. Might be called from a private queue.
Declaration
Swift
public func activateLocationProvider() -
Stops the location engine. Might be called from a private queue.
Declaration
Swift
public func deactivateLocationProvider()
-
Show vehicle restrictions layers on the map respective to the given
Vehicle.Declaration
Swift
public func showVehicleRestrictions(vehicle: Vehicle) throws -
Show vehicle restrictions layers on the map respective to the current
Vehicle. If aVehiclewasn’t set, it is imperative to set theVehiclebefore calling this function, and reload the style after calling function to see the vehicle restrictions layers on the map.Throws
An error of typeVehicleRestrictionsErrorif the vehicle restrictions could not be shown.Declaration
Swift
public func showVehicleRestrictions() throws -
Hide vehicle restrictions layers from the map.
Declaration
Swift
public func hideVehicleRestrictions() -
Updates the current
Vehicleinformation.Declaration
Swift
public func updateVehicle(_ vehicle: Vehicle)
TomTomMap Class Reference