ViewabilityListener

public protocol ViewabilityListener : AnyObject

Listens to viewablity events for a view

Can be attached to an instance of UIView or its subclass by calling trackView on it

  • Notifies the listener that the view has entered visible screen

    Note

    This method is always called on the main thread

    Declaration

    Swift

    func viewStarted(_ view: UIView)

    Parameters

    view

    The instance of view that just entered the viewport

  • Notifies the listener that the view has completely moved out of the visible screen

    Note

    This method is always called on the main thread

    Declaration

    Swift

    func viewEnded(_ view: UIView, maxPercentage: Float)

    Parameters

    view

    The instance of view that exited the viewport