I am trying to add an animation to my application using Lottie but I get this error and I still do not know how to solve it.
import UIKit
import Lottie
class ViewController: UIViewController {
@IBOutlet var animationView: AnimationView!
override func viewDidLoad() {
super.viewDidLoad()
startAnimation()
}
func startAnimation(){
animationView.setAnimation(named: "data")//error1
animationView.loopAnimation = true//error2
animationView.play()
}
}
The error that comes out:
Value of type 'AnimationView?' has no member 'setAnimation'
Value of type 'AnimationView?' has no member 'loopAnimation'
I'm using lottie-ios version 3.1.3 and ran into this same issue. After a little bit of digging I found that the syntax has changed. For your first error you need to change the code to the following:
animationView.animation = Animation.named("spineffectloader")
For the second error you should change the code to the following:
animationView.loopMode = .loop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With