-
Go to download sample lottie json. lottie-bird
-
You craete folder then into this json.
-
You move to folder in app project also check Create folder references box.
-
If you use storyboard
let animation = Animation.named("bird", subdirectory: "TestAnimations")
lottie.animation = animation
lottie.contentMode = .scaleAspectFit
And finaly call play functions in viewdidappear
lottie.play(fromProgress: 0,
toProgress: 1,
loopMode: LottieLoopMode.playOnce,
completion: { (finished) in
if finished {
print("Animation Complete")
} else {
print("Animation cancelled")
}
})
- You want to use programmatic lottie files, look this lottie-swift