MMKTrafficLayer

@interface MMKTrafficLayer : NSObject

A layer with traffic information.

Summary

Instance methods

- (BOOL)isTrafficVisible;
Checks if traffic is visible

- (void)setTrafficVisibleWithOn:(BOOL)on;
Sets traffic visibility

- (BOOL)setTrafficStyleWithStyle:(nonnull NSString *)style;
Applies JSON style transformations to the traffic layer

- (BOOL)setTrafficStyleWithId:(NSInteger)id style:(nonnull NSString *)style;
Applies JSON style transformations to the traffic layer

- (void)resetTrafficStyles;
Resets all JSON style transformations applied to the traffic layer

- (void)addTrafficListenerWithTrafficListener:
    (nonnull id<MMKTrafficDelegate>)trafficListener;

Adds a traffic listener

- (void)removeTrafficListenerWithTrafficListener:
    (nonnull id<MMKTrafficDelegate>)trafficListener;

Removes a traffic listener

Properties

@property (nonatomic, readonly, getter=isValid) BOOL valid;
Tells if this object is valid or no

Instance methods

isTrafficVisible

- (BOOL)isTrafficVisible;

Checks if traffic is visible.


setTrafficVisibleWithOn:

- (void)setTrafficVisibleWithOn:(BOOL)on;

Sets traffic visibility.


setTrafficStyleWithStyle:

- (BOOL)setTrafficStyleWithStyle:(nonnull NSString *)style;

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:

- (BOOL)setTrafficStyleWithId:(NSInteger)id style:(nonnull NSString *)style;

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

- (void)resetTrafficStyles;

Resets all JSON style transformations applied to the traffic layer.


addTrafficListenerWithTrafficListener:

- (void)addTrafficListenerWithTrafficListener:
    (nonnull id<MMKTrafficDelegate>)trafficListener;

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.


removeTrafficListenerWithTrafficListener:

- (void)removeTrafficListenerWithTrafficListener:
    (nonnull id<MMKTrafficDelegate>)trafficListener;

Removes a traffic listener.


Properties

valid

@property (nonatomic, readonly, getter=isValid) BOOL valid;

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.