This new release finally enables to observe the progress or frame of a Lottie animation in real time for macOS apps! In order to do so, you can use the same .onFrame(_:)
or .onProgress(_:)
modifiers from the iOS counterpart.
However there's a caveat...
With the introduction of Lottie 4.0, the animation observers of LottieUI stopped working properly when rendering an animation with the new CoreAnimation setting, both for iOS and macOS. If you need to make use of the .onFrame(_:)
or .onProgress(_:)
modifiers, make sure that you're using the Main Thread rendering engine for now. You can set it by using the .renderingEngine(_:)
method:
LottieView("my-animation")
.renderingEngine(.mainThread) // setup the mainThread engine before observing progress/framerate
.onFrame { _ in
// ...
}
I've created an issue #10 to keep track of any progress on getting the animation observer working on the new rendering engine.