<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuickLookUI",
  "identifier" : "/documentation/QuickLookUI/QLPreviewPanelDelegate/previewPanel(_:sourceFrameOnScreenFor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Quick Look UI"
    ],
    "preciseIdentifier" : "c:objc(pl)QLPreviewPanelDelegate(im)previewPanel:sourceFrameOnScreenForPreviewItem:"
  },
  "title" : "previewPanel(_:sourceFrameOnScreenFor:)"
}
-->

# previewPanel(_:sourceFrameOnScreenFor:)

Returns the screen rectangle for a given preview item.

```
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

The screen rectangle for the given preview item. Return <doc://com.apple.documentation/documentation/Foundation/NSZeroRect> if there is no origin point (this will produce a fade of the panel).

## 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.

---

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)