Skip to main content
net10.0-ios26.0

.NET bindings for the Lottie Swift library

Published
Mar 27, 2026
6mo ago
Total Downloads
1.4K
1,391

Install

dotnet add package SwiftBindings.Lottie --version 4.6.0-preview.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.

# 1. Build the xcframework from SPM
./build-xcframework.sh

# 2. Build the package (SDK generates bindings automatically)
dotnet build

License

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

Adoption Assessment

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

This version is marked prerelease. Validate its API and upgrade path before production use.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.