YMKMapObject

class YMKMapObject : NSObject

An object displayed on the map.

Summary

Instance methods

func setVisibleWithVisible(_ visible: Bool,
                           animation: YMKAnimation,
                            callback: YMKCallback? = nil)
Manages visibility of the object

func addTapListener(with tapListener: YMKMapObjectTapListener)
Adds a tap listener to the object

func removeTapListener(with tapListener: YMKMapObjectTapListener)
Removes the tap listener from the object

func setDragListenerWith( dragListener: YMKMapObjectDragListener_?)
Sets a drag listener for the object

Properties

var parentYMKBaseMapObjectCollection { get }
Returns the collection of map objects that the current map object belongs to

var isVisible: Bool { get set }
Manages visibility of the object on the map

var zIndex: Float { get set }
Gets the z-index, which affects: <ul><li>Rendering order

var isDraggable: Bool { get set }
If true, the map object can be dragged by the user

var userData: Any? { get set }
Use this property to attach any object-related metadata

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

Instance methods

setVisibleWithVisible(_:animation:callback:)

func setVisibleWithVisible(_ visible: Bool,
                           animation: YMKAnimation,
                            callback: YMKCallback? = nil)

Manages visibility of the object.

Parameters

animation

Describes the transition between visible and not visible states.

onFinished

Called when the transition is finished.


addTapListener(with:)

func addTapListener(with tapListener: YMKMapObjectTapListener)

Adds a tap listener to the object.

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


removeTapListener(with:)

func removeTapListener(with tapListener: YMKMapObjectTapListener)

Removes the tap listener from the object.


setDragListenerWith(_:)

func setDragListenerWith( dragListener: YMKMapObjectDragListener_?)

Sets a drag listener for the object. Each object can only have one drag listener.

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


Properties

parent

var parent: YMKBaseMapObjectCollection { get }

Returns the collection of map objects that the current map object belongs to.


isVisible

var isVisible: Bool { get set }

Manages visibility of the object on the map. Default: true.


zIndex

var zIndex: Float { get set }

Gets the z-index, which affects:

  • Rendering order.
  • Dispatching of UI events (taps and drags are dispatched to objects with higher z-indexes first).
Z-index is relative to the parent.


isDraggable

var isDraggable: Bool { get set }

If true, the map object can be dragged by the user. Default: false.


userData

var userData: Any? { get set }

Use this property to attach any object-related metadata.

Optional property, can be nil.


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.