Releases: thorvg/thorvg.swift
v0.1.2
v0.1.1
[0.1.1] - 2025-11-20
Fixed
- Release Process: Corrected v0.1.0 tag to properly include pre-built XCFramework binaries
- This is the actual first stable release with all assets
Note
- v0.1.0 was published without the XCFramework due to a release process issue
- All users should use v0.1.1 or later for access to pre-built binaries
v0.1.0
We're excited to announce the initial public release of ThorVGSwift - a lightweight Swift wrapper around the ThorVG C++ API, bringing native vector graphics rendering to Swift applications! π
π Highlights
ThorVGSwift provides two powerful ways to work with Lottie animations:
- Low-Level API: Direct access to the rendering engine for frame-by-frame control
- High-Level Views API: Ready-to-use SwiftUI and UIKit components with automatic playback
β¨ Features
Core Functionality
- β Lottie animation rendering
- β
LottieRendererfor low-level frame-by-frame control - β Cross-platform: iOS 13.0+ and macOS 10.15+
- β
SwiftUI
LottieViewcomponent - β
UIKit
LottieUIKitViewcomponent - β
LottieViewModelfor state management
Playback Controls
- β Loop modes: Play once, loop, repeat N times, auto-reverse
- β Speed control (0.1x to 10x)
- β Seeking to frames or progress
- β Play, pause, stop controls
Rendering Options
- β Content modes: Aspect fit and fill
- β Flexible sizing with automatic intrinsic sizing
- β Multiple pixel formats (ARGB, RGBA, ABGR, BGRA)
- β Optional multi-threaded rendering
Developer Experience
- β Type-safe Swift API
- β Error handling via Combine
- β Real-time progress tracking
- β Pre-built XCFramework (no build steps!)
- β Sample app included
- β Complete documentation
π¦ Installation
Add to your Package.swift:
dependencies: [
.package(url: "https://github.com/thorvg/thorvg.swift", from: "0.1.0")
]π Quick Start
SwiftUI
import SwiftUI
import ThorVGSwift
struct ContentView: View {
@StateObject private var viewModel: LottieViewModel
init() {
let lottie = try! Lottie(path: "animation.json")
let config = LottieConfiguration(loopMode: .loop, speed: 1.0)
_viewModel = StateObject(wrappedValue: LottieViewModel(
lottie: lottie,
configuration: config
))
}
var body: some View {
LottieView(viewModel: viewModel)
.onAppear { viewModel.play() }
}
}UIKit
import UIKit
import ThorVGSwift
class ViewController: UIViewController {
private var viewModel: LottieViewModel!
override func viewDidLoad() {
super.viewDidLoad()
let lottie = try! Lottie(path: "animation.json")
let config = LottieConfiguration(loopMode: .loop, speed: 1.0)
viewModel = LottieViewModel(lottie: lottie, configuration: config)
let lottieView = LottieUIKitView(viewModel: viewModel)
view.addSubview(lottieView)
viewModel.play()
}
}Low-Level API (Direct Rendering)
For advanced use cases requiring frame-by-frame control:
import ThorVGSwift
// Load Lottie animation
let lottie = try Lottie(path: "animation.json")
// Create a buffer for rendering
let size = CGSize(width: 1024, height: 1024)
var buffer = [UInt32](repeating: 0, count: Int(size.width * size.height))
// Initialize renderer
let renderer = LottieRenderer(
lottie,
size: size,
buffer: &buffer,
stride: Int(size.width),
pixelFormat: .argb
)
// Render a specific frame
let contentRect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
try renderer.render(frameIndex: 0, contentRect: contentRect, rotation: 0.0)
// Buffer now contains the rendered frame data
// Iterate through lottie.numberOfFrames for full animationThe low-level API gives you complete control over:
- Frame Selection: Render any frame on demand
- Buffer Management: Bring your own buffer and pixel format
- Multi-threading: Create custom
Enginewith multiple threads - Content Region: Render specific regions with custom cropping
- Rotation: Apply rotation transforms during rendering
Perfect for custom video export, frame analysis, or integration with other rendering pipelines.
π Documentation
- README - Quick start and overview
- Views API Documentation - Complete API reference
- Contributing Guide - How to contribute
- Build System Guide - Build details
- Sample App - Interactive examples
π§ Technical Details
- ThorVG Version: v1.0-pre32 (commit cf1557c)
- Supported Platforms:
- macOS: arm64 + x86_64 (Universal Binary)
- iOS Device: arm64
- iOS Simulator: arm64
- Build System: Meson + Ninja
- Distribution: Static library via XCFramework
- Swift Version: 5.9+
β οΈ Known Limitations
- Content Types: Currently only supports Lottie animations. SVG and other formats planned for future releases.
- Threading: Multi-threading available but disabled by default on iOS/macOS to avoid OpenMP linking complexity with SPM.
π Acknowledgments
Thanks to the ThorVG team for creating the amazing rendering engine, and to all early testers and contributors!
π Full Changelog
See (thorvg.swift/docs/CHANGELOG.md) for complete details.
Known Limitations
- Only Lottie animations are currently supported (SVG and other formats coming in future releases)
- Threading disabled on iOS and macOS to avoid OpenMP linking issues with Swift Package Manager
π Reporting Issues
Found a bug? Please open an issue.
π¬ Community
- GitHub Discussions - Share ideas and ask questions
Happy coding! π