pub struct AsyncOverlaySubjects { /* private fields */ }async only.Expand description
True-async entry point for ImageAnalysisOverlayView.subjects and
ImageAnalysisOverlayView.subject(at:) (macOS).
On macOS the subject APIs live on ImageAnalysisOverlayView
(Rust: LiveTextInteraction), not directly on ImageAnalysis.
Both require macOS 13+ and the crate::ImageAnalysisTypes::VISUAL_LOOK_UP
analysis type in the configuration used when the analysis was performed.
§Note on subject bounds coordinate space
Bounds are in the same coordinate space that VisionKit uses when populating
the overlay view. That is, they are relative to the view’s bounds as
configured via setPreferredInteractionTypes and setAnalysis(_:).
Implementations§
Source§impl AsyncOverlaySubjects
impl AsyncOverlaySubjects
Sourcepub fn new(interaction: &LiveTextInteraction) -> Self
pub fn new(interaction: &LiveTextInteraction) -> Self
Wrap a LiveTextInteraction for async subject queries.
The interaction must remain alive for as long as the returned
futures are pending.
Sourcepub fn subjects(&self) -> SubjectsFuture ⓘ
pub fn subjects(&self) -> SubjectsFuture ⓘ
Asynchronously retrieve all subjects as their bounds rectangles.
Internally calls await overlayView.subjects on the Swift side
(requires @MainActor). Each subject’s bounds is accessed
synchronously within that actor context.
Returns an empty Vec when no subjects are found or when the analysis
did not include crate::ImageAnalysisTypes::VISUAL_LOOK_UP.
Sourcepub fn subject_at(&self, x: f64, y: f64) -> SubjectAtFuture ⓘ
pub fn subject_at(&self, x: f64, y: f64) -> SubjectAtFuture ⓘ
Asynchronously find the subject at the given overlay-coordinate point.
Returns Ok(None) when no subject is present at (x, y).