---
title: "previewPanel(_:sourceFrameOnScreenFor:)"
framework: quicklookui
role: symbol
role_heading: Instance Method
path: "quicklookui/qlpreviewpaneldelegate/previewpanel(_:sourceframeonscreenfor:)"
---

# previewPanel(_:sourceFrameOnScreenFor:)

Returns the screen rectangle for a given preview item.

## Declaration

```swift
optional func previewPanel(_ panel: QLPreviewPanel!, sourceFrameOnScreenFor item: (any QLPreviewItem)!) -> NSRect
```

## Parameters

- `panel`: The preview panel.
- `item`: The preview item for which the screen rectangle is required.

## Return Value

Return Value The screen rectangle for the given preview item. Return NSZeroRect if there is no origin point (this will produce a fade of the panel).

## Discussion

Discussion The system invokes this optional method when the preview panel opens or closes to provide a zoom effect. You should return — in screen coordinates — the rectangle that displays the specified preview item.

## See Also

### Optional Methods

- [previewPanel(_:handle:)](quicklookui/qlpreviewpaneldelegate/previewpanel(_:handle:).md)
- [previewPanel(_:transitionImageFor:contentRect:)](quicklookui/qlpreviewpaneldelegate/previewpanel(_:transitionimagefor:contentrect:).md)
