<!--
{
  "availability" : [
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VisionKit",
  "identifier" : "/documentation/VisionKit/ImageAnalysisOverlayViewDelegate/contentsRect(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "VisionKit"
    ],
    "preciseIdentifier" : "s:9VisionKit32ImageAnalysisOverlayViewDelegateP12contentsRect3forSo6CGRectVAA0cdeF0C_tF"
  },
  "title" : "contentsRect(for:)"
}
-->

# contentsRect(for:)

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

```
@MainActor func contentsRect(for overlayView: ImageAnalysisOverlayView) -> CGRect
```

## Parameters

`overlayView`

The associated overlay view for the contents rectangle.

## Return Value

The rectangle of the image within the view, in unit coordinates. The default return value is the unit rectangle `[0.0, 0.0, 1.0, 1.0]`, which represents the whole view contents.

## Discussion

Implement this method if the [`trackingImageView`](/documentation/VisionKit/ImageAnalysisOverlayView/trackingImageView)
type isn’t <doc://com.apple.documentation/documentation/AppKit/NSImageView>.

---

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)