new to Lottie iOS. I downloaded many json recordsdata and got here to know that, for some causes, some do not play appropriately.
Right here is my code:
import SwiftUI
import Lottie
struct LottieAnimation: View {
var title: String
var contentMode: UIView.ContentMode
var playbackMode: LottiePlaybackMode
var didFinish: (() -> Void)? = nil
var width: CGFloat? = nil
var peak: CGFloat? = nil
var scaleFactor: CGFloat? = nil
var cornerRadiusFactor: Double? = nil
var physique: some View {
LottieView(animation: .named(title))
.configure({ configuration in
configuration.contentMode = contentMode
})
.playbackMode(playbackMode)
.animationDidFinish({ accomplished in
didFinish?()
})
.body(width: width, peak: peak)
.scaleEffect(scaleFactor ?? 1)
.cornerRadius(cornerRadiusFactor ?? 0)
}
}
#Preview {
LottieAnimation(title: "abc", contentMode: .scaleAspectFit, playbackMode: .enjoying(.toProgress(1, loopMode: .loop)))
}
This is able to be the right enjoying of the file:
https://lottiefiles.com/animations/game-east-west-0icTdVbReO?from=search
That is what occurs to my file
I downloaded the “JSON” file from lottiefiles. Sorry for the unhealthy high quality, the general pace is just not affected. It is only a GIF downside. Thanks
Xcode model: 15.0
iOS goal: 16.0
Lottie model: 4.4.3