QuartileTracker
public struct QuartileTracker
A value type that tracks quartile progress for a single ad playback.
Reset via reset() whenever a new ad starts, then call evaluate(ad:progress:fire:)
on every progress update. The tracker guarantees forward-only state progression:
none → first → mid → third.
-
Undocumented
Declaration
Swift
public init() -
Resets tracking back to the initial
.nonestate.Call this every time a new ad starts to clear any state left from the previous ad.
Declaration
Swift
public mutating func reset() -
Evaluates whether any quartile threshold has been crossed and fires the corresponding
AdTrackingEventviafire.Declaration
Swift
public mutating func evaluate(ad: Ad, progress: TimeInterval, fire: (AdTrackingEvent) -> Void)Parameters
adThe ad currently being played.
progressElapsed playback time within the ad, in seconds.
fireClosure invoked with the
AdTrackingEventwhen a threshold is crossed.