visionkit-rs
Safe Rust bindings for Apple's VisionKit.framework on macOS.
Status: v0.3.0 adds a Tier-1 async API module on top of full v0.2.x coverage of
ImageAnalysisOverlayView,ImageAnalyzer,ImageAnalysis, and availability metadata for the iOS-only areas.
Quick start
use *;
Async API (async feature)
Enable with visionkit = { version = "0.3", features = ["async"] }.
use ;
use ;
Note: block_on must be called from the main thread. It pumps the Obj-C RunLoop.main between polls so that @MainActor Swift tasks can make progress. Use any executor-agnostic async runtime (Tokio, async-std, etc.) with the provided futures — just ensure RunLoop.main is pumped externally if not using block_on.
Highlights
ImageAnalyzer::is_supportedandsupported_text_recognition_languagesImageAnalyzerConfiguration,ImageAnalysisTypes, andImageOrientation- File-path based analysis through every public macOS analyzer overload: URL,
NSImage,CGImage,CIImage, andCVPixelBuffer ImageAnalysis::transcriptandhas_results- full
LiveTextInteractioncoverage for macOSImageAnalysisOverlayView, including delegates, menu tags, selection metadata, tracking/content views, fonts, and subject analysis VNDocumentCameraViewController,DataScannerViewController,RecognizedText,Barcode, andRecognizedItemavailability metadata on macOS
Availability
ImageAnalyzer,ImageAnalysis, andLiveTextInteractionare available on macOS 13+.LiveTextInteraction::text,selected_text,selected_attributed_text,selected_ranges, andLiveTextMenuTagrequire macOS 14+ because Apple introduced those overlay accessors after macOS 13.VNDocumentCameraViewController,DataScannerViewController,RecognizedText,Barcode, andRecognizedItemare iOS-only Apple APIs. On macOS, this crate exposes them as structured availability metadata instead of pretending they exist.
Examples
See COVERAGE.md for the audited VisionKit API matrix.
License
Licensed under either of Apache-2.0 or MIT at your option.