Replies: 3 comments 1 reply
-
Though not recommended, dot lottie can loaded in synchronous fashion too. You can use |
Beta Was this translation helpful? Give feedback.
-
Thanks @kirti-swiggy, this works, if possible can you let me know if any down side for the approach ? Most of my .lottie files won't be bigger than 100 kb, so can I use it even though my thread will be blocked for a split second ? |
Beta Was this translation helpful? Give feedback.
-
Yeah. Only side effect is that the dispatcher thread will be blocked till .lottie is decompressed and ready to be rendered. Test it on some sample lotties and see if it works for you.
|
Beta Was this translation helpful? Give feedback.
-
For ".json" files I am easily able to it via
LottieAnimation
model if the container viewLottieAnimationView
is defined in story board.Below is my code to load ".json" Lottie files
Is there a way to load dotLottie file in the same way ? I have checked in the SDK files and found DotLottieFile class which loads it in an asynchronous way but nothing as simple as above.
Even the
LottieAnimationView.init(dotLottieName: "dot_lottie_file")
initialiser is not working, I thought of create the below extension to extract the animation object even that didn't workCan anyone point to me in the right direction on loading ".json" & ".lottie" files in
LottieAnimationView
if it's defined in storyboardLottie Version: 4.5.1
Edit :
Seems like I was not using the completion handler for the initialiser LottieAnimationView.init(dotLottieName: "dot_lottie_file"), thus it was not working, so to load dotLottie files I always have to use a completionHandler ? It cannot be loaded in a synchronous way ?
Beta Was this translation helpful? Give feedback.
All reactions