Skip to main content
net10.0-ios26.0

.NET bindings for the Lottie Swift library

Published
Jun 1, 2026
4mo ago
Total Downloads
1.4K
1,391

Install

dotnet add package SwiftBindings.Lottie --version 4.6.2
ProductVersions
.NET
net10.0-ios26.0

README

SwiftBindings.Lottie

Native Swift interop bindings for Lottie, Airbnb's library for rendering After Effects animations natively on iOS. These are not Objective-C proxy wrappers — they use .NET 10's native Swift interop for direct, high-performance calls into Swift APIs from C#.

Installation

dotnet add package SwiftBindings.Lottie

Requirements

  • .NET 10.0+
  • iOS 15.0+
  • macOS host for development

Usage

Load and play an animation

using Lottie;

// Load from a bundled JSON file
var animation = LottieAnimation.Named("LoadingSpinner");

// Create the animation view and play
var animView = new LottieAnimationView();
animView.Animation = animation;
animView.LoopMode = LottieLoopMode.Loop;
animView.Play();

Playback control

// Play, pause, stop
animView.Play();
animView.Pause();
animView.Stop();

// Play a specific progress range
animView.Play(fromProgress: 0.0, toProgress: 0.5);

// Adjust speed and check state
animView.AnimationSpeed = 1.5;
var isPlaying = animView.IsAnimationPlaying;

// Scrub to a specific frame or progress
animView.CurrentProgress = 0.5;
animView.CurrentFrame = 30.0;
animView.ForceDisplayUpdate();

Animation properties

var animation = LottieAnimation.Named("Confetti");

var duration = animation.Duration;
var framerate = animation.Framerate;
var startFrame = animation.StartFrame;
var endFrame = animation.EndFrame;
var markers = animation.MarkerNames;

Cache management

var cache = DefaultAnimationCache.SharedCache;
cache.CacheSize = 50;

// Cache and retrieve animations
cache.SetAnimation(animation, "my-key");
var cached = cache.Animation("my-key");
cache.ClearCache();

Colors and value providers

// Create colors (RGBA 0.0-1.0)
var color = new LottieColor(1.0, 0.5, 0.25, 1.0);

// Or with 0-255 range
var color255 = new LottieColor(255.0, 128.0, 64.0, 255.0,
    ColorFormatDenominator.TwoFiftyFive);

// Dynamic value providers for animation properties
var floatProvider = new FloatValueProvider(0.75);
var sizeProvider = new SizeValueProvider((Swift.CGSize)new CGSize(100, 200));
var pointProvider = new PointValueProvider((Swift.CGPoint)new CGPoint(50, 75));

How It Works

These bindings are auto-generated by Swift Dotnet Bindings using .NET 10's native Swift interop via the SwiftBindings SDK.

Building from Source

Only needed if you're contributing or building the package locally.

# One-time: install the pinned Nuke CLI from .config/dotnet-tools.json
dotnet tool restore

# Build the package end-to-end (xcframework + bindings + dotnet build)
dotnet nuke BuildLibrary --library Lottie

License

The bindings are MIT licensed. Lottie itself is Apache 2.0 licensed — see Lottie's license.

Changes from Previous Version

No structural changes between v4.6.1 and v4.6.2.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.