---
title: "documentInteractionControllerRectForPreview(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uidocumentinteractioncontrollerdelegate/documentinteractioncontrollerrectforpreview(_:)"
---

# documentInteractionControllerRectForPreview(_:)

Called when a document interaction controller needs the rectangle to use as the starting point for animating the display of a document preview.

## Declaration

```swift
optional func documentInteractionControllerRectForPreview(_ controller: UIDocumentInteractionController) -> CGRect
```

## Parameters

- `controller`: The document interaction controller requesting the starting rectangle.

## Return Value

Return Value A rectangle in the coordinate system of the view returned by the documentInteractionControllerViewForPreview(_:) method.

## Discussion

Discussion If you do not implement the documentInteractionControllerViewForPreview(_:) method, or if you do implement it but return a nil value, this method is not called. If you do not implement this method, the starting rectangle is assumed to be the bounds of the view returned by the documentInteractionControllerViewForPreview(_:) method.

## See Also

### Configuring the parent view controller

- [documentInteractionControllerViewControllerForPreview(_:)](uikit/uidocumentinteractioncontrollerdelegate/documentinteractioncontrollerviewcontrollerforpreview(_:).md)
- [documentInteractionControllerViewForPreview(_:)](uikit/uidocumentinteractioncontrollerdelegate/documentinteractioncontrollerviewforpreview(_:).md)
