DotLottieFile
init with Data
#2087
-
For my use case, I need to download a dotLottie file from the remote and store it in a persistent cache so that I can load the lottie from the cache for the next launch(es). I am able to download the data ( Please suggest if there's another way to do this. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
If you're interested in this functionality you could submit a pull request adding a helper for this to DotLottieFileHelpers.swift. It seems reasonable to have a helper for creating a |
Beta Was this translation helpful? Give feedback.
-
I have a similar use-case where we want to init a DotLottieFile with Data, except it needs to be done synchronously. This is possible using case .json(let dict):
if let animation = try? LottieAnimation(dictionary: dict) {
LottieView(animation: animation)
} But the only init for case .data(data: let data):
LottieView({
try await .dotLottieFile(.loadedFrom(data: data, filename: "abc"))
}) Is it possible to add a synchronous initializer for case .data(data: let data):
if let dotLottie = try? DotLottieFile(data: data) {
LottieView(dotLottie: dotLottie)
} Please let me know if there's already a way to do this! Thanks. |
Beta Was this translation helpful? Give feedback.
If you're interested in this functionality you could submit a pull request adding a helper for this to DotLottieFileHelpers.swift. It seems reasonable to have a helper for creating a
DotLottieFile
from aFoundation.Data
, considering we also have aData
helper forLottieAnimation
itself here.