<!--
{
  "availability" : [
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VisionKit",
  "identifier" : "/documentation/VisionKit/ImageAnalysisOverlayViewDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "VisionKit"
    ],
    "preciseIdentifier" : "s:9VisionKit32ImageAnalysisOverlayViewDelegateP"
  },
  "title" : "ImageAnalysisOverlayViewDelegate"
}
-->

# ImageAnalysisOverlayViewDelegate

A delegate that handles image-analysis and user-interaction callbacks for an overlay view.

```
@MainActor protocol ImageAnalysisOverlayViewDelegate : AnyObject
```

## Overview

The delegate of an [`ImageAnalysisOverlayView`](/documentation/VisionKit/ImageAnalysisOverlayView) object implements this
protocol to provide interface details and to customize the response for a person’s interaction.

## Topics

### Providing interface details

[`func contentView(for: ImageAnalysisOverlayView) -> NSView?`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/contentView(for:))

Provides the view that contains the image.

[`func contentsRect(for: ImageAnalysisOverlayView) -> CGRect`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/contentsRect(for:))

Returns the rectangle, in unit coordinate space, that contains the image within the view.

### Starting the interaction

[`func overlayView(ImageAnalysisOverlayView, shouldBeginAt: CGPoint, forAnalysisType: ImageAnalysisOverlayView.InteractionTypes) -> Bool`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:shouldBeginAt:forAnalysisType:))

Provides a Boolean value that indicates whether the interaction can begin at the given point.

### Tracking interface changes

[`func overlayView(ImageAnalysisOverlayView, liveTextButtonDidChangeToVisible: Bool)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:liveTextButtonDidChangeToVisible:))

Notifies your app when the Live Text button’s visibility changes.

[`func overlayView(ImageAnalysisOverlayView, highlightSelectedItemsDidChange: Bool)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:highlightSelectedItemsDidChange:))

Notifies your app when recognized items in the image appear highlighted as a result of a person clicking or tapping the Live Text button.

[`func textSelectionDidChange(ImageAnalysisOverlayView)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/textSelectionDidChange(_:))

Notifies your app when the interaction’s text selection changes.

### Responding to key and menu events

[`func overlayView(ImageAnalysisOverlayView, shouldHandleKeyDownEvent: NSEvent) -> Bool`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:shouldHandleKeyDownEvent:))

Returns a Boolean value that indicates whether the overlay view consumes the given key-down event.

[`func overlayView(ImageAnalysisOverlayView, shouldShowMenuForEvent: NSEvent, atPoint: CGPoint) -> Bool`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:shouldShowMenuForEvent:atPoint:))

Provides a Boolean value that indicates whether the overlay view shows a menu for the given event.

[`func overlayView(ImageAnalysisOverlayView, menu: NSMenu, willHighlight: NSMenuItem?)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:menu:willHighlight:))

Notifies your app that the given menu item is highlighted.

[`func overlayView(ImageAnalysisOverlayView, willOpen: NSMenu)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:willOpen:))

Notifies your app that a given menu is opening imminently.

[`func overlayView(ImageAnalysisOverlayView, didClose: NSMenu)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:didClose:))

Notifies your app that the given menu closed.

[`func overlayView(ImageAnalysisOverlayView, needsUpdate: NSMenu)`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:needsUpdate:))

Notifies your app that the given menu needs updating.

[`func overlayView(ImageAnalysisOverlayView, updatedMenuFor: NSMenu, for: NSEvent, at: CGPoint) -> NSMenu`](/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/overlayView(_:updatedMenuFor:for:at:))

Notifies your app before the framework presents a context menu.



---

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)