Is there a way to know when an Lottie animation
is finished? I need to delete
a tableViewCell
but only AFTER the animation
is finished. This is the animation
:
Setup:
//MARK: setup Loading-Animation
func setupLoadingAnimation(){
successAnimation.translatesAutoresizingMaskIntoConstraints = false
self.contentView.addSubview(successAnimation)
successAnimation.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: -30).isActive = true
successAnimation.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
successAnimation.widthAnchor.constraint(equalToConstant: 160).isActive = true
successAnimation.heightAnchor.constraint(equalToConstant: 160).isActive = true
successAnimation.isHidden = true
successAnimation.loopMode = .playOnce
}
Action:
@objc func checkButtonTapped(){
self.deleteWishCallback?()
self.successAnimation.isHidden = false
self.successAnimation.play()
}
What I would like to achieve is to be able to call self.deleteWishCallback?()
in the closure of self.successAnimation.play()
. Is there a way to get this done ? Couldnt find anything on this!