Understand the Swift Bridge structure
mainThe screencapturekit-rs project uses a Swift bridge to expose macOS's ScreenCaptureKit to Rust via C-compatible symbols (@_cdecl). The bridge is organized into several functional domains:
- Capture Control:
Stream.swifthandles stream lifecycle. - Content Discovery:
ShareableContent.swiftmanages finding available content. - Configuration:
StreamConfiguration.swiftdefines stream settings. - Advanced Features:
ScreenshotManager.swift(macOS 14+),RecordingOutput.swift(macOS 15+), andContentSharingPicker.swift(macOS 14+). - Data Types: Provides bindings for
CoreGraphics(CGImage, CGRect),CoreMedia(CMSampleBuffer, CMTime),CoreVideo(CVPixelBuffer),IOSurface, andDispatch(DispatchQueue).