'Lottie iOS animation is not working in mobile

We’ve tried to implement Lottie animation in iOS app. we added a json file which works fine in android and web but not in iOS i.e., title is invisible and extra lines are appeared on background. here’s code snippet used to play Lottie animation:

animationView = .init(name: "experts") // json file name
animationView?.frame = view.bounds
animationView?.contentMode = .scaleAspectFill
animationView?.loopMode = .playOnce
animationView?.animationSpeed = 0.5
view.addSubview(animationView!)
animationView?.play { (finished) in
    // animation is finished
}

Lottie iOS version - 3.3.0 Xcode version - 12.4 iOS version - 12.5/15.3



Solution 1:[1]

Try the below code, it's working fine:-

animationView.animation = Animation.named("74683-delivery") //JSON file name
animationView.center = view.center
animationView.frame = view.bounds
animationView.backgroundColor = .white
animationView.contentMode = .scaleAspectFit
animationView.loopMode = .playOnce
animationView.play()
view.addSubview(animationView)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Saurabh Pathak