Releases: tfmart/LottieUI
v1.3.3 - Progress/Frame observers for macOS
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.
1.3.2 - Updated Lottie version
Updated Lottie dependency version to 4.0.1 (PR #8)
v1.3.1 - macOS scaling issues fix
Thank you for trying out LottieUI! This version includes a bug fix for the new LottieView counterpart for macOS, in which the animation could fail to scale down when trying to constraint the size of it. For more information, checkout #4 (Issue #3)
If you're using or planning to use LottieUI on a macOS project, it's highly recommended that you update to this version.
As always, if you run into any issues feel free to open a new issue or open a pull request with your suggestions. Contributions are always welcome!
v1.3 - LottieUI arrives on the Mac
LottieUI is finally on the Mac. Bring all your delightful Lottie animations on your SwiftUI projects Mac, all with the simple and familiar syntax and (almost) all the features that you know from iOS!
There's also some few smaller changes included. Here's a breakdown of what's new:
Mac Support
Both LottieView
and AsyncLottieView
are now available for macOS, using the same syntax from their iOS counterpart. You can also customize all the modifiers to customize the animation, such as playback, speed, loop mode and more.
The only feature missing from the iOS version are the animation progress or frame rate observers. I've opened an issue explaining the problem I've ran into but I'm planning to ship this feature on a future release once I sort it out
Documentation
I updated this project README to include a clearer description of some of LottieUI features along a brand new set of GIFs to better illustrate how each modifier works
Miscellaneous
- Removed AsyncLottieView's
init(url:, animation:, placeholder:
initializer, as it made use of a private API - Updated Lottie framework to 3.4.2
Thanks for your interest in LottieUI. As always, if you run into any issue, feel free to create an issue. Contributions are also always welcome, so if you'd like to submit an improvement or a new feature you can always fork this repository and open a pull request with your changes
v1.2 - Rendering Engine Support
Thank you for your interest in LottieUI! This release include a new modifier for LottieView
, which allows you to use the new Core Animation Rendering Engine introduced in Lottie 3.4.0 earlier this month.
By using this rendering engine, the CPU load from playing an animation can be greatly reduced, even if the animation is looping:
By default, LottieView will use the previous thread, as not all animations are compatible with this engine. To opt-in simply use the new .renderingEngine
modifier on your view:
LottieView("Cactus")
.renderingEngine(.coreAnimation)
You can read more about the new Core Animation animation rendering engine here
v1.1 - New AsyncLottieView phase initializer, reduced CPU usage
Thank you for your interest in LottieView! This release includes a new way to handle different states when an animation is being downloaded and a few bug fixes
AsyncLottieView Phases
It is now possible to present different views according to the download state of a AsyncLottieView
, such as while the animation is being downloaded or in case the download fails
AsyncLottieView(url: url) { phase in
switch phase {
case .loading:
// View to be displayed when the animation is being downloaded
Text("Loading...")
case .error:
// View to be displayed if the download fails
Text("Error")
case let .success(lottieView):
// A LottieView which contains the downloaded animation
lottieView
.loopMode(.loop)
.play(isPlaying)
.onFrame { frametime in
self.currentFramerate = frametime
}
}
}
Bug fixes
- Reduced CPU usage when using
onFrame
andonProgress
modifiers on aLottieView
- Fixed an issue when setting a
repeat()
loop mode on aLottieView
- Fixed an issue in which
onFrame
would return a value of zero while the animation was playing
v1.0 - Initial Release
This is the initial release of the LottieUI package! This initial release contains:
LottieView
component to display an animation from a local fileAsyncLottieView
component to display an animation from a remote URL.play(_:)
modifier to control whether the animation is playing or not.loopMode(_:)
modifier to set how the animation loops.onFrame(_:)
modifier to observe the current frame of the animation being displayed.onProgress(_:)
modifier to observe the current progress of the animation.speed(_:)
modifier to set the animation speed.play(fromFrame:to:)
to limit the frames being displayed in the animation.backgroundBehaviour(_:)
to set the animation behavior when the app enters the background.valueProvider(_:keypath:)
to set new values for an animation's key path