I'm using the Lottie library for iOS and trying to load an animation in .json format downloaded LottieFiles.
I'm using this code in the viewDidLoad()
method:
let animationView = LOTAnimationView(name: "infinite_rainbow")
animationView.loopAnimation = true
animationView.frame = CGRect(x: 0, y: 0, width: 400, height: 400)
animationView.center = self.view.center
animationView.contentMode = .scaleAspectFill
view.addSubview(animationView)
animationView.play()
Problem: just the first frame gets displayed, but the animation doesn't play. I have tried several files but the result is the same.
I'm using:
Xcode 9.1
Swift 4
Lottie-ios v2.1.5 (cocoapod)