# airbnb/lottie-ios architecture

> Architecture diagram of the GitHub repository airbnb/lottie-ios, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/airbnb/lottie-ios
- Repository: https://github.com/airbnb/lottie-ios

## Overview

Lottie for iOS is a Swift library that decodes Bodymovin animation data and renders it in native views. The main workflow is to load JSON (or a .lottie archive), configure playback and providers, select a rendering engine, then display and control the animation. Its rendering branches include Core Animation and a main-thread node renderer; runtime keypath/value overrides, text and image assets, controls, and caches are additional capabilities. Edges follow explicit README statements or SOURCE INDEX references; unsampled subsystem links are omitted where their callers are not evidenced.

Main entry points: [`Sources/Public/Animation/LottieAnimationLayer.swift`](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimationLayer.swift) (Playback layer), [`Sources/Public/Animation/LottieAnimationView.swift`](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimationView.swift) (Animation view), [`Sources/Private/RootAnimationLayer.swift`](https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/RootAnimationLayer.swift) (Root layer), [`Sources/Private/CoreAnimation/CoreAnimationLayer.swift`](https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/CoreAnimation/CoreAnimationLayer.swift) (Core Animation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_view["Animation view"]
  node_swiftui["SwiftUI view<br/>[LottieView.swift]"]
  node_configuration["Configuration"]
  node_controls["Animated controls"]
  node_logger["Logger<br/>[LottieLogger.swift]"]
end

subgraph group_input["Animation Inputs"]
  node_animation["Animation model"]
  node_dotfile["DotLottie file"]
  node_models["Layer and shape models"]
end

subgraph group_playback["Playback Control"]
  node_playback_layer["Playback layer"]
  node_context["Playback context"]
end

subgraph group_render["Rendering Engines"]
  node_root["Root layer"]
  node_compatibility["Engine compatibility"]
  node_core["Core Animation"]
  node_mainthread["Main-thread renderer"]
  node_nodes["Shape node system"]
end

subgraph group_assets["Runtime Extensions"]
  node_cache["Animation cache"]
  node_keypath["Keypath overrides"]
  node_valueprovider["Value providers"]
  node_imageprovider["Image provider"]
  node_bundleimages["Bundle images"]
  node_textprovider["Text provider"]
  node_fontprovider["Font provider"]
end

node_user(("App developer"))

node_user -->|"creates view"| node_view
node_user -->|"embeds animation"| node_swiftui
node_view -->|"manages playback"| node_playback_layer
node_view -->|"loads model"| node_animation
node_dotfile -->|"contains animations"| node_animation
node_view -->|"loads archive"| node_dotfile
node_view -->|"uses settings"| node_configuration
node_playback_layer -->|"creates context"| node_context
node_playback_layer -->|"selects renderer"| node_root
node_playback_layer -->|"configures engine"| node_core
node_playback_layer -->|"configures engine"| node_mainthread
node_core -->|"reports issues"| node_compatibility
node_core -->|"builds layer hierarchy"| node_models
node_mainthread -.->|"renders shapes"| node_nodes
node_playback_layer -->|"searches properties"| node_keypath
node_playback_layer -->|"sets overrides"| node_valueprovider
node_root -->|"provides images"| node_imageprovider
node_bundleimages -->|"implements provider"| node_imageprovider
node_root -->|"provides fonts"| node_fontprovider
node_root -.->|"provides text"| node_textprovider
node_controls -->|"controls playback"| node_playback_layer
node_view -.->|"uses cache"| node_cache
node_imageprovider -->|"logs warnings"| node_logger

click node_view "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimationView.swift"
click node_swiftui "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieView.swift"
click node_animation "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimation.swift"
click node_dotfile "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/DotLottie/DotLottieFile.swift"
click node_configuration "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Configuration/LottieConfiguration.swift"
click node_playback_layer "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimationLayer.swift"
click node_context "https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/Utility/Helpers/AnimationContext.swift"
click node_root "https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/RootAnimationLayer.swift"
click node_compatibility "https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/CoreAnimation/CompatibilityTracker.swift"
click node_core "https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/CoreAnimation/CoreAnimationLayer.swift"
click node_mainthread "https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift"
click node_models "https://github.com/airbnb/lottie-ios/tree/master/Sources/Private/Model/Layers"
click node_nodes "https://github.com/airbnb/lottie-ios/tree/master/Sources/Private/MainThread/NodeRenderSystem"
click node_cache "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/AnimationCache/DefaultAnimationCache.swift"
click node_keypath "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/DynamicProperties/AnimationKeypath.swift"
click node_valueprovider "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/DynamicProperties/AnyValueProvider.swift"
click node_imageprovider "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/ImageProvider/AnimationImageProvider.swift"
click node_bundleimages "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/iOS/BundleImageProvider.swift"
click node_textprovider "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/TextProvider/AnimationTextProvider.swift"
click node_fontprovider "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/FontProvider/AnimationFontProvider.swift"
click node_controls "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Controls/AnimatedControl.swift"
click node_logger "https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Logging/LottieLogger.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_view,node_swiftui,node_configuration,node_controls,node_logger toneBlue
class node_animation,node_dotfile,node_models toneAmber
class node_playback_layer,node_context toneMint
class node_root,node_compatibility,node_core,node_mainthread,node_nodes toneRose
class node_cache,node_keypath,node_valueprovider,node_imageprovider,node_bundleimages,node_textprovider,node_fontprovider,node_user toneIndigo
```

## Components

### Public API

- [Animation view](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimationView.swift): `Sources/Public/Animation/LottieAnimationView.swift`
- [SwiftUI view](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieView.swift): `Sources/Public/Animation/LottieView.swift`
- [Configuration](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Configuration/LottieConfiguration.swift): `Sources/Public/Configuration/LottieConfiguration.swift`
- [Animated controls](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Controls/AnimatedControl.swift): `Sources/Public/Controls/AnimatedControl.swift`
- [Logger](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Logging/LottieLogger.swift): `Sources/Public/Logging/LottieLogger.swift`

### Animation Inputs

- [Animation model](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimation.swift): `Sources/Public/Animation/LottieAnimation.swift`
- [DotLottie file](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/DotLottie/DotLottieFile.swift): `Sources/Public/DotLottie/DotLottieFile.swift`
- [Layer and shape models](https://github.com/airbnb/lottie-ios/tree/master/Sources/Private/Model/Layers): `Sources/Private/Model/Layers`

### Playback Control

- [Playback layer](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/Animation/LottieAnimationLayer.swift): `Sources/Public/Animation/LottieAnimationLayer.swift`
- [Playback context](https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/Utility/Helpers/AnimationContext.swift): `Sources/Private/Utility/Helpers/AnimationContext.swift`

### Rendering Engines

- [Root layer](https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/RootAnimationLayer.swift): `Sources/Private/RootAnimationLayer.swift`
- [Engine compatibility](https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/CoreAnimation/CompatibilityTracker.swift): `Sources/Private/CoreAnimation/CompatibilityTracker.swift`
- [Core Animation](https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/CoreAnimation/CoreAnimationLayer.swift): `Sources/Private/CoreAnimation/CoreAnimationLayer.swift`
- [Main-thread renderer](https://github.com/airbnb/lottie-ios/blob/master/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift): `Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift`
- [Shape node system](https://github.com/airbnb/lottie-ios/tree/master/Sources/Private/MainThread/NodeRenderSystem): `Sources/Private/MainThread/NodeRenderSystem`

### Runtime Extensions

- [Animation cache](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/AnimationCache/DefaultAnimationCache.swift): `Sources/Public/AnimationCache/DefaultAnimationCache.swift`
- [Keypath overrides](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/DynamicProperties/AnimationKeypath.swift): `Sources/Public/DynamicProperties/AnimationKeypath.swift`
- [Value providers](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/DynamicProperties/AnyValueProvider.swift): `Sources/Public/DynamicProperties/AnyValueProvider.swift`
- [Image provider](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/ImageProvider/AnimationImageProvider.swift): `Sources/Public/ImageProvider/AnimationImageProvider.swift`
- [Bundle images](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/iOS/BundleImageProvider.swift): `Sources/Public/iOS/BundleImageProvider.swift`
- [Text provider](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/TextProvider/AnimationTextProvider.swift): `Sources/Public/TextProvider/AnimationTextProvider.swift`
- [Font provider](https://github.com/airbnb/lottie-ios/blob/master/Sources/Public/FontProvider/AnimationFontProvider.swift): `Sources/Public/FontProvider/AnimationFontProvider.swift`

### Other components

- **App developer**

## Connections

- App developer → Animation view: creates view (evidence: `README.md`)
- App developer → SwiftUI view: embeds animation (evidence: `README.md`)
- Animation view → Playback layer: manages playback (evidence: `Sources/Public/Animation/LottieAnimationLayer.swift`)
- Animation view → Animation model: loads model (evidence: `Sources/Public/Animation/LottieAnimationView.swift`)
- DotLottie file → Animation model: contains animations (evidence: `Sources/Public/DotLottie/DotLottieFile.swift`)
- Animation view → DotLottie file: loads archive (evidence: `Sources/Public/Animation/LottieAnimationView.swift`)
- Animation view → Configuration: uses settings (evidence: `Sources/Public/Animation/LottieAnimationView.swift`)
- Playback layer → Playback context: creates context (evidence: `Sources/Private/Utility/Helpers/AnimationContext.swift`)
- Playback layer → Root layer: selects renderer (evidence: `Sources/Public/Animation/LottieAnimationLayer.swift`)
- Playback layer → Core Animation: configures engine (evidence: `Sources/Public/Animation/LottieAnimationLayer.swift`)
- Playback layer → Main-thread renderer: configures engine (evidence: `Sources/Public/Animation/LottieAnimationLayer.swift`)
- Core Animation → Engine compatibility: reports issues (evidence: `Sources/Private/CoreAnimation/CoreAnimationLayer.swift`)
- Core Animation → Layer and shape models: builds layer hierarchy (evidence: `Sources/Private/CoreAnimation/CoreAnimationLayer.swift`)
- Main-thread renderer → Shape node system: renders shapes (evidence: `Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift`)
- Playback layer → Keypath overrides: searches properties (evidence: `Sources/Public/Animation/LottieAnimationLayer.swift`)
- Playback layer → Value providers: sets overrides (evidence: `Sources/Public/Animation/LottieAnimationLayer.swift`)
- Root layer → Image provider: provides images (evidence: `Sources/Private/RootAnimationLayer.swift`)
- Bundle images → Image provider: implements provider (evidence: `Sources/Public/iOS/BundleImageProvider.swift`)
- Root layer → Font provider: provides fonts (evidence: `Sources/Private/RootAnimationLayer.swift`)
- Root layer → Text provider: provides text
- Animated controls → Playback layer: controls playback
- Animation view → Animation cache: uses cache
- Image provider → Logger: logs warnings (evidence: `Sources/Public/iOS/BundleImageProvider.swift`)
