Lottie 3.0.3
I expect that the animation worked as it did in pre 3.x versions.
The app crashes.
I have code like this:
import UIKit
import Lottie
class BlockForNonProViewController: UIViewController {
@IBOutlet weak var animationContainer: AnimationView!
@IBOutlet weak var okButton: UIButton!
var shouldHideOkButton: Bool = true
override func viewDidLoad() {
super.viewDidLoad()
let animation = Animation.named("blocked-animation")
animationContainer.animation = animation
animationContainer.contentMode = .scaleAspectFit
animationContainer.loopMode = .loop
animationContainer.play()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
okButton.isHidden = shouldHideOkButton
}
@IBAction func okButtonTapped(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
}
}
The app crashes on the line animationContainer.animation = animation with an "unrecognized selector sent to instance". It seems the view controller itself is sent the selector removeFromLayer which makes no sense on a view controller.
The animation view is an IBOutlet which perhaps is what version 3.x can't handle?
possible duplicate of Issue 826
Seems like a duplicate. Setting the module field to Lottie should fix this problem. Its a strange issue with cocoapods and swift that it doesnt autofill. Im looking into that.
Most helpful comment
Seems like a duplicate. Setting the module field to
Lottieshould fix this problem. Its a strange issue with cocoapods and swift that it doesnt autofill. Im looking into that.