Closed zzzworm closed 2 years ago
Hi. This PR seems long-time ago.
Recentlly lottie GitHub close the old performance regression issue, So let's rock to Lottie 3 and pure Swift instead.
I use #7 instead for this PR
After re-check your changes again
One small question: Shouldn't the user set the Lottie.AnimationView.imageProvider
before call sd_setImage(with:)
API ?🤔 I tested and it work...
@zzzworm
For 1.0.0 Lottie Plugin, you can use both of two ways for custom image provider and bundle.
let url: URL
let animationView: AnimationView
animationView.imageProvider = BundleImageProvider(bundle: bundle, searchPath: nil)
animationView.sd_setImage(with: url)
let json: Data
let animation = try JSONDecoder().decode(Animation.self, from: data)
let lottieImage = LottieImage(animation: animation)
lottieImage.imageProvider = BundleImageProvider(bundle: bundle, searchPath: nil)
let poster = lottieImage.animatedImageFrame(at: 0))
See more in Tests.swift
There are support for provide the NSBundle during lottie URL loading for Lottie v2, but the 1.x branch did not support it, So I add it for the Lottie V3