MapKit Mobile SDK

MMKTrafficLayer

class MMKTrafficLayer : NSObject

A layer with traffic information.

Summary

Instance methods

func isTrafficVisible() -> Bool
Checks if traffic is visible

func setTrafficVisibleWithOn(_ on: Bool)
Sets traffic visibility

func setTrafficStyleWithStyle(_ style: String) -> Bool
Applies JSON style transformations to the traffic layer

func setTrafficStyleWithId(_ id: Int, style: String) -> Bool
Applies JSON style transformations to the traffic layer

func resetTrafficStyles()
Resets all JSON style transformations applied to the traffic layer

func addTrafficListener(withTrafficListener trafficListener: MMKTrafficDelegate)
Adds a traffic listener

func removeTrafficListener(withTrafficListener trafficListener: MMKTrafficDelegate)
Removes a traffic listener

Properties

var isValid: Bool { get }
Tells if this object is valid or no

Instance methods

isTrafficVisible()

func isTrafficVisible() -> Bool

Checks if traffic is visible.


setTrafficVisibleWithOn(_:)

func setTrafficVisibleWithOn(_ on: Bool)

Sets traffic visibility.


setTrafficStyleWithStyle(_:)

func setTrafficStyleWithStyle(_ style: String) -> Bool

Applies JSON style transformations to the traffic layer. Same as setTrafficStyle(0, style). Set to empty string to clear previous styling. Returns true if the style was successfully parsed; false otherwise. If the return value is false, the current traffic style remains unchanged.


setTrafficStyleWithId(_:style:)

func setTrafficStyleWithId(_ id: Int, style: String) -> Bool

Applies JSON style transformations to the traffic layer. Replaces previous styling with the specified ID (if such exists). Stylings are applied in an ascending order. Set to empty string to clear previous styling with the specified ID. Returns true if the style was successfully parsed; false otherwise. If the return value is false, the current traffic style remains unchanged.


resetTrafficStyles()

func resetTrafficStyles()

Resets all JSON style transformations applied to the traffic layer.


addTrafficListener(withTrafficListener:)

func addTrafficListener(withTrafficListener trafficListener: MMKTrafficDelegate)

Adds a traffic listener.

The class does not retain the object in the 'trafficListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeTrafficListener(withTrafficListener:)

func removeTrafficListener(withTrafficListener trafficListener: MMKTrafficDelegate)

Removes a traffic listener.


Properties

isValid

var isValid: Bool { get }

Tells if this object is valid or no. Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.