MapActions

public protocol MapActions : AnyObject

MapActions defines a set of methods closely connected to the map.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Sets the map style mode based on the provided StyleContainer. If MapOptions.mapStyle does not contain a style for the given mode, no action will be performed.

    Declaration

    Swift

    var styleMode: StyleMode { get set }
  • Returns all currently added [Layer] elements.

    Declaration

    Swift

    var layers: [Layer] { get }
  • Allows to change the default gesture detection behavior. For example invocation of this method with the following parameters: setExclusiveGestures(gesture: .pinch, blockedGestures: [.rotate]) .rotate being ignored if its not already ongoing before .pinch. Passing an empty array will remove any restrictions for the given gesture type. For example default configuration does not allow for .rotate to occur when .pinch is in progress. However after invocation of setExclusiveGestures(gesture: .pinch, blockedGestures: []) this restriction will be lifted off.

    @param gesture Gesture which configuration will be altered @param blockedGestures Array of gestures that will be ignored when gesture provided as first parameter is in progress.

    Declaration

    Swift

    func setExclusiveGestures(gesture: GestureType, blockedGestures: [GestureType])
  • OptionSet for disabling the given map interaction gestures.

    • Example: let mapView = TomTomMapView() mapView.map.disabledGestures = [.doubleTap(), .tap()]

    Declaration

    Swift

    var disabledGestures: MapGestureDisableOption { get set }
  • Provides information about what main (usually light) and dark styles are defined. Each style is defined as a StyleDefinition.

    Declaration

    Swift

    var styleContainer: StyleContainer { get set }
  • Provides initial CameraOptions where zoom, tilt and rotation can be defined.

    Declaration

    Swift

    var cameraOptions: CameraOptions { get set }
  • Fetches an array of Layer‘s based on a given regex pattern. The regex is applied to the Layer.id property.

    • Example:

      mapView.tomTomMap.layersForRegexp(pattern: ".*[rR]oad.*")
      

    Declaration

    Swift

    func layersForRegexp(pattern: String) -> [Layer]

    Parameters

    pattern

    The regex pattern.

    Return Value

    An array of Layer‘s whose IDs fulfill the given pattern.

  • Changes the labels displayed on the map to a given language. List of supported languages.

    • Example:

      mapView.tomTomMap.setLanguage.setLanguage("en-GB")
      

    Declaration

    Swift

    func setLanguage(_ language: String)

    Parameters

    language

    Language string. Must be a supported language.

  • Transforms a given CGPoint to a CLLocationCoordinate2D object.

    Declaration

    Swift

    func coordinateForPoint(point: CGPoint) -> CLLocationCoordinate2D?

    Parameters

    point

    The point for transformation.

    Return Value

    The CLLocationCoordinate2D object that contains CLLocationCoordinate2D. If coordinate is incorrect, it returns nil.

  • Converts a given geographic location to a screen coordinate.

    Declaration

    Swift

    func pointForCoordinate(coordinate: CLLocationCoordinate2D) -> CGPoint?

    Parameters

    coordinate

    The geographic location represented by CLLocationCoordinate2D

    Return Value

    The CGPoint object that contains x and y in the screen coordinate system.

  • A method to generate a static UIImage image of the map view.

    Declaration

    Swift

    func snapshot() -> UIImage

    Return Value

    Static UIImage image of the map view.

  • This method generates a static UIImage image of the map view.

    Declaration

    Swift

    func snapshotWithoutViews(views: [UIView]) -> UIImage

    Parameters

    views

    Views that are in the map hierarchy, but which should not be in the snapshot.

    Return Value

    Static UIImage image of the map view.

  • Displays traffic flow on the road.

    Declaration

    Swift

    func showTraffic()
  • Hides traffic flow on the road.

    Declaration

    Swift

    func hideTraffic()
  • Displays traffic incidents on the road.

    Declaration

    Swift

    func showTrafficIncidents()
  • Hides traffic incidents on the road.

    Declaration

    Swift

    func hideTrafficIncidents()
  • Register OnTrafficIncidentObservation that allow to notification when TrafficIncident was clicked.

    Declaration

    Swift

    func registerTrafficIncidentObserver(_ observer: OnTrafficIncidentObservation)
  • An array of zoom levels and sizes for position marker. Values between specified records are produced as a result of linear interpolation. You have to provide at least 2 records.

    Declaration

    Swift

    var positionMarkerSizes: [PositionMarkerSize] { get set }