<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VisionKit",
  "identifier" : "/documentation/VisionKit/ImageAnalysisInteractionDelegate/contentsRect(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "VisionKit"
    ],
    "preciseIdentifier" : "s:9VisionKit32ImageAnalysisInteractionDelegateP12contentsRect3forSo6CGRectVAA0cdE0C_tF"
  },
  "title" : "contentsRect(for:)"
}
-->

# contentsRect(for:)

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

```
@MainActor func contentsRect(for interaction: ImageAnalysisInteraction) -> CGRect
```

## Parameters

`interaction`

The associated interaction object 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 when the interaction view type isn’t
<doc://com.apple.documentation/documentation/UIKit/UIImageView>.

---

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)