---
title: "contentsRect(for:)"
framework: visionkit
role: symbol
role_heading: Instance Method
path: "visionkit/imageanalysisinteractiondelegate/contentsrect(for:)"
---

# contentsRect(for:)

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

## Declaration

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

## Parameters

- `interaction`: The associated interaction object for the contents rectangle.

## Mentioned in

Enabling Live Text interactions with images

## Return Value

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

Discussion Implement this method when the interaction view type isn’t UIImageView.

## See Also

### Providing interface details

- [contentView(for:)](visionkit/imageanalysisinteractiondelegate/contentview(for:).md)
- [presentingViewController(for:)](visionkit/imageanalysisinteractiondelegate/presentingviewcontroller(for:).md)
