Lottie · iOS

Lottie in iOS

Add Lottie animated icons to your iOS or iPadOS app using Swift Package Manager and LottieAnimationView.

1

Add Lottie via Swift Package Manager

In Xcode, go to your project settings → Package Dependencies and add the Lottie package.

https://github.com/airbnb/lottie-ios
2

Add the animation to your ViewController

Import Lottie, create a LottieAnimationView with the name of your downloaded icon file (without the .json extension), and add it to the view.

copy
import Lottie

class ViewController: UIViewController {
    var animationView: LottieAnimationView!

    override func viewDidLoad() {
        super.viewDidLoad()

        animationView = LottieAnimationView(name: "your_animation")
        animationView.frame = CGRect(x: 0, y: 0, width: 150, height: 150)
        animationView.center = view.center
        animationView.loopMode = .loop
        animationView.play()
        view.addSubview(animationView)
    }
}
3

Control the animation

Use the animation view instance to control playback at runtime.

copy
animationView.play()
animationView.pause()
animationView.stop()
animationView.loopMode = .playOnce
Get your icons
Browse animated icons ready for iOS.
Browse free icons →