pub struct AsyncImageAnalyzer { /* private fields */ }async only.Expand description
True-async entry point for ImageAnalyzer.analyze(imageAt:orientation:configuration:).
Requires macOS 13+. The returned AnalyzeImageFuture resolves to an
ImageAnalysis that can then be inspected synchronously via its existing
methods or have its subjects queried via AsyncOverlaySubjects.
Implementations§
Source§impl AsyncImageAnalyzer
impl AsyncImageAnalyzer
Sourcepub fn new() -> Result<Self, VisionKitError>
pub fn new() -> Result<Self, VisionKitError>
Create a new AsyncImageAnalyzer.
§Errors
Returns VisionKitError::UnavailableOnThisMacOS if the device does
not run macOS 13 or later.
Sourcepub fn is_supported() -> bool
pub fn is_supported() -> bool
Returns true when the current Mac supports ImageAnalyzer.
Sourcepub fn analyze_image_at_path<P: AsRef<Path>>(
&self,
path: P,
orientation: ImageOrientation,
configuration: &ImageAnalyzerConfiguration,
) -> Result<AnalyzeImageFuture, VisionKitError>
pub fn analyze_image_at_path<P: AsRef<Path>>( &self, path: P, orientation: ImageOrientation, configuration: &ImageAnalyzerConfiguration, ) -> Result<AnalyzeImageFuture, VisionKitError>
Asynchronously analyze the image at path and return an ImageAnalysis.
This is a true async wrapper: the Swift bridge spawns a
Task { @MainActor … }, calls
await analyzer.analyze(imageAt:orientation:configuration:), and fires
a C callback when done. The returned AnalyzeImageFuture resolves
when that callback fires.
§Errors
Returns VisionKitError if the path cannot be represented as a C
string, if the configuration cannot be serialized, or if VisionKit
reports an analysis error.