<!--
{
  "availability" : [
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VisionKit",
  "identifier" : "/documentation/VisionKit/ImageAnalysisOverlayView",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "VisionKit"
    ],
    "preciseIdentifier" : "c:@M@VisionKit@objc(cs)ImageAnalysisOverlayView"
  },
  "title" : "ImageAnalysisOverlayView"
}
-->

# ImageAnalysisOverlayView

A view that enables people to interact with recognized text, barcodes, and other objects in an image.

```
@MainActor @objc final class ImageAnalysisOverlayView
```

## Overview

This class enables people to interact with specific content types ([`ImageAnalysisOverlayView.InteractionTypes`](/documentation/VisionKit/ImageAnalysisOverlayView/InteractionTypes)) that the framework identifies in an image. For example:

- The Live Text interface enables them to select any text present in the image ([`textSelection`](/documentation/VisionKit/ImageAnalysisOverlayView/InteractionTypes/textSelection)), or invoke a URL ([`dataDetectors`](/documentation/VisionKit/ImageAnalysisOverlayView/InteractionTypes/dataDetectors)). The text selection UI offers framework-standard buttons for copying selected text, or looking it up on the web for more information.
- The *subject lift* feature identifies a wide variety of objects, or *subjects*, in images with the [`imageSubject`](/documentation/VisionKit/ImageAnalysisOverlayView/InteractionTypes/imageSubject) interaction type, and provides your app with an image of the objects with the background removed. The [`visualLookUp`](/documentation/VisionKit/ImageAnalysisOverlayView/InteractionTypes/visualLookUp) type supplements this feature by adding a button in the bottom corner of the view that people can click or tap for more information about the recognized subjects.

## Configure the interface and begin interaction

To connect the interface with an image that your app displays, add a new instance of this class as a subview to your app’s image view.

Choose the items that the framework recognizes in an image by configuring the  [`preferredInteractionTypes`](/documentation/VisionKit/ImageAnalysisOverlayView/preferredInteractionTypes) property. To recognize all types of content, specify the [`automatic`](/documentation/VisionKit/ImageAnalysisOverlayView/InteractionTypes/automatic) option, or choose a combination of types by assigning an array:

```swift
overlayView.preferredInteractionTypes = [.textSelection, .imageSubject]
```

To begin interaction, call one of the [`ImageAnalyzer`](/documentation/VisionKit/ImageAnalyzer) class’s `analyze` methods, such as [`analyze(_:configuration:)`](/documentation/VisionKit/ImageAnalyzer/analyze(_:configuration:)) and set the result onto this class’s [`analysis`](/documentation/VisionKit/ImageAnalysisOverlayView/analysis) property.

You can take more control over the interaction or provide details about your app’s image view by implementing a delegate ([`ImageAnalysisInteractionDelegate`](/documentation/VisionKit/ImageAnalysisInteractionDelegate)) and assigning it to the [`delegate`](/documentation/VisionKit/ImageAnalysisInteraction/delegate) property. Your app needs to define the interactive area within the image either by setting the [`trackingImageView`](/documentation/VisionKit/ImageAnalysisOverlayView/trackingImageView) property, or by implementing the delegate’s [`contentsRect(for:)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/contentsRect(for:)) method.

## Topics

### Creating overlay views

[`init(_:)`](/documentation/VisionKit/ImageAnalysisOverlayView/init(_:))

Creates an overlay view with the specified delegate object.

[`init(frame:)`](/documentation/VisionKit/ImageAnalysisOverlayView/init(frame:))

Creates an overlay view with the specified frame rectangle.

[`init(coder:)`](/documentation/VisionKit/ImageAnalysisOverlayView/init(coder:))

Creates an overlay view from data in a coder object.

### Configuring overlay views

[`delegate`](/documentation/VisionKit/ImageAnalysisOverlayView/delegate)

An object that handles image analysis interface callbacks.

[`analysis`](/documentation/VisionKit/ImageAnalysisOverlayView/analysis)

The results of analyzing an image for items that people can interact with.

[`preferredInteractionTypes`](/documentation/VisionKit/ImageAnalysisOverlayView/preferredInteractionTypes)

The types of interactions that people can perform with the image in this overlay view.

[`ImageAnalysisOverlayView.InteractionTypes`](/documentation/VisionKit/ImageAnalysisOverlayView/InteractionTypes)

The types of interactions that people can perform with an image.

[`trackingImageView`](/documentation/VisionKit/ImageAnalysisOverlayView/trackingImageView)

The image view that contains the image.

[`activeInteractionTypes`](/documentation/VisionKit/ImageAnalysisOverlayView/activeInteractionTypes)

The types of interactions that a person actively performs.

### Responding to view events

[`viewDidMoveToSuperview()`](/documentation/VisionKit/ImageAnalysisOverlayView/viewDidMoveToSuperview())

Notifies your app when the view initially appears.

### Accessing text information

[`text`](/documentation/VisionKit/ImageAnalysisOverlayView/text)

The text contents of the current image analysis.

[`selectedText`](/documentation/VisionKit/ImageAnalysisOverlayView/selectedText)

The current selected text.

[`selectedAttributedText`](/documentation/VisionKit/ImageAnalysisOverlayView/selectedAttributedText)

The current selected attributed text.

[`hasActiveTextSelection`](/documentation/VisionKit/ImageAnalysisOverlayView/hasActiveTextSelection)

A Boolean value that indicates whether a person or the app has text selected within the image.

[`analysisHasText(at:)`](/documentation/VisionKit/ImageAnalysisOverlayView/analysisHasText(at:))

Returns a Boolean value that indicates whether the analysis finds text at the specified
point.

[`hasText(at:)`](/documentation/VisionKit/ImageAnalysisOverlayView/hasText(at:))

Returns a Boolean value that indicates whether active text exists at the specified
point.

[`hasDataDetector(at:)`](/documentation/VisionKit/ImageAnalysisOverlayView/hasDataDetector(at:))

Returns a Boolean value that indicates whether the analysis detects data at the specified
point.

### Managing text selection

[`selectedRanges`](/documentation/VisionKit/ImageAnalysisOverlayView/selectedRanges)

The current selected ranges.

[`resetSelection()`](/documentation/VisionKit/ImageAnalysisOverlayView/resetSelection())

Removes a person’s text selection from the interface.

### Accessing image subjects

[`subjects`](/documentation/VisionKit/ImageAnalysisOverlayView/subjects)

The set of all subjects the framework identifies in an image.

[`ImageAnalysisOverlayView.Subject`](/documentation/VisionKit/ImageAnalysisOverlayView/Subject)

An area of interest in an image that the framework identifies as a primary focal point.

[`image(for:)`](/documentation/VisionKit/ImageAnalysisOverlayView/image(for:))

Provides an image asynchronously that contains the given subjects with the background removed.

[`subject(at:)`](/documentation/VisionKit/ImageAnalysisOverlayView/subject(at:))

Returns the subject at the given point within the overlay view’s image, if one exists.

### Managing image subjects

[`beginSubjectAnalysisIfNecessary()`](/documentation/VisionKit/ImageAnalysisOverlayView/beginSubjectAnalysisIfNecessary())

Begins subject analysis on the overlay view’s image.

[`highlightedSubjects`](/documentation/VisionKit/ImageAnalysisOverlayView/highlightedSubjects)

All highlighted subjects in the overlay view’s image.

### Querying the interface state

[`liveTextButtonVisible`](/documentation/VisionKit/ImageAnalysisOverlayView/liveTextButtonVisible)

A Boolean value that indicates whether the Live Text button appears.

[`isSupplementaryInterfaceHidden`](/documentation/VisionKit/ImageAnalysisOverlayView/isSupplementaryInterfaceHidden)

A Boolean value that indicates whether the view hides supplementary interface objects.

[`hasInteractiveItem(at:)`](/documentation/VisionKit/ImageAnalysisOverlayView/hasInteractiveItem(at:))

Returns a Boolean value that indicates whether active text, data detectors, or supplementary
interface objects exist at the specified point.

[`hasSupplementaryInterface(at:)`](/documentation/VisionKit/ImageAnalysisOverlayView/hasSupplementaryInterface(at:))

Returns a Boolean value that indicates whether supplementary interface objects exist
at the specified point.

[`selectableItemsHighlighted`](/documentation/VisionKit/ImageAnalysisOverlayView/selectableItemsHighlighted)

A Boolean value that indicates whether the overlay view highlights actionable text
or data that the analyzer detects in text.

### Customizing the interface

[`setSupplementaryInterfaceHidden(_:animated:)`](/documentation/VisionKit/ImageAnalysisOverlayView/setSupplementaryInterfaceHidden(_:animated:))

Hides or shows supplementary interface objects, such as the Live Text button and
the interface for Quick Actions, depending on the item type.

[`supplementaryInterfaceContentInsets`](/documentation/VisionKit/ImageAnalysisOverlayView/supplementaryInterfaceContentInsets)

The distances the edges of content are inset from the supplementary interface.

[`supplementaryInterfaceFont`](/documentation/VisionKit/ImageAnalysisOverlayView/supplementaryInterfaceFont)

The font to use for the supplementary interface.

[`ImageAnalysisOverlayView.MenuTag`](/documentation/VisionKit/ImageAnalysisOverlayView/MenuTag)

Tags that enable your app to manage image-analysis context menu items.

### Managing custom image views

[`contentsRect`](/documentation/VisionKit/ImageAnalysisOverlayView/contentsRect)

Returns the rectangle, in unit coordinates, that contains the image within the superview.

[`setContentsRectNeedsUpdate()`](/documentation/VisionKit/ImageAnalysisOverlayView/setContentsRectNeedsUpdate())

Informs the view that contains the image when the layout changes and the view needs to reload its content.

### Errors

[`ImageAnalysisOverlayView.SubjectUnavailable`](/documentation/VisionKit/ImageAnalysisOverlayView/SubjectUnavailable)

Error conditions that can occur during subject analysis.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)