Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setAnimation changed since Lottie 3.0 update?

Tags:

ios

swift

lottie

The AirBNB's README.md for Lottie IOS updated. setAnimation not in Readme, and not registering in swift dropdown list of selectors for updated version 3.0.0 Has anyone experienced this issue? Lottie cocoapod is successfully installed.

README.md trial and error restart

@IBOutlet private var animationView: AnimationView!

override func viewDidLoad() {
    super.viewDidLoad()

    startAnimation()

}

func startAnimation() {

    animationView.setAnimation(named: "spineffectloader")
    animationView.play()

}
like image 386
joeyryanbridges Avatar asked Apr 09 '19 04:04

joeyryanbridges


1 Answers

In swift, you need to update code as follow to register animation:

animationView.animation = Animation.named("spineffectloader")

To start animation use following code:

animationView.play { (finished) in
    /// Animation finished
}
like image 159
Sagar Chauhan Avatar answered Oct 31 '22 15:10

Sagar Chauhan