TempoDriven

@MainActor
public protocol TempoDriven : TempoDelegate

This protocol represents objects that subscribe to a TempoProviding object’s update beats. Every movement of a value occurs because time has changed. These beats drive the motion, sending timestamps by which delta values can be calculated. All standard MotionMachine motion classes conform to this protocol.

Important

While you aren’t required to implement this protocol in order to update your own custom Moveable classes, it is the preferred way to interact with the MotionMachine ecosystem unless your requirements prevent using TempoProviding objects for updating your value interpolations.
  • An object conforming to the TempoProviding protocol that provides an update “beat” while a motion operation occurs.

    Note

    By default, this class will assign an instance of DisplayLinkTempo to this property, which automatically chooses the best tempo class for the system platform. For iOS, visionOS, and tvOS the class chosen is CATempo, but for macOS it is MacDisplayLinkTempo. Both classes internally use a CADisplayLink object for updates. For watchOS and non-Apple platforms, TimerTempo is chosen as CADisplayLink is not available.

    Declaration

    Swift

    @MainActor
    var tempo: TempoProviding? { get set }
  • Tells a TempoDriven object to cease listening to updates from its TempoProviding object.

    Declaration

    Swift

    @MainActor
    func stopTempoUpdates()