Overview of SwiftVLC
mainSwiftVLC is a Swift 6 wrapper around libVLC 4.0 designed specifically for SwiftUI applications. It provides a modern Swift interface by binding directly to the libVLC C API without an Objective-C intermediary.
Key architectural features include:
- Observable state: The
Playerclass is@Observableand@MainActor, allowing SwiftUI views to automatically track properties likestate,currentTime,duration, and track lists. - Typed errors: Errors use
throws(VLCError), providing a full, type-safe error surface. - Structured events: Playback, discovery, logging, and dialog prompts are surfaced via
AsyncStream, supporting multiple concurrent consumers. - Ownership-aware overlays: Components like
Marquee,Logo, andVideoAdjustmentsare~Copyableand~Escapable, scoped to the player's lifetime to prevent dangling pointers.