I have tried also calling animations from within a UIViewRepresentable:
func makeUIView(context: Context) -> some DotLottieAnimationView {
let view: UIView = UIView(frame: .zero)
let simpleVM = DotLottieAnimation(fileName: animationFileName, config: AnimationConfig(autoplay: true, loop: true))
let loaderView: DotLottieAnimationView = simpleVM.view()
loaderView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(loaderView)
loaderView.frame = view.bounds
return loaderView
}
While I am able to isolate and avoid certain animations, I haven’t been able to resolve the lagging and high energy impact. I am unable to make updates to my app using this new package until I can resolve these issues. I appreciate any feedback.
hi @Sack_of_Songs Theres a few things I can propose to help with these issues:
Disabling frame interpolation will help with increasing performance and might not cause a noticeable difference in your case
Try changing the width and height. This can cause a resolution drop if you decrease it too much, but in my experience you can lower these values and increase performance without a noticeable difference
More advanced performance improvement would be to pause playback if the animation isn’t visible on screen
I was able to mostly resolve the issues yesterday by switching to the new Lottie crafted for SwiftUI. However, there is a noticeable second or two delay compared to using the deprecated DotLottie.
The latest dotLottie-ios update appears to introduce performance issues, especially with high energy usage and crashes during specific animations. Disabling useFrameInterpolation may help. Ensure the animations are optimized and avoid heavy rendering within SwiftUI views. Use Instruments to identify slowdowns or memory spikes, particularly during transitions or loops.