<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuickLook",
  "identifier" : "/documentation/QuickLook/QLPreviewControllerDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Quick Look"
    ],
    "preciseIdentifier" : "c:objc(pl)QLPreviewControllerDelegate"
  },
  "title" : "QLPreviewControllerDelegate"
}
-->

# QLPreviewControllerDelegate

The protocol that a delegate of a preview controller needs to adopt to handle Quick Look previews.

```
protocol QLPreviewControllerDelegate : NSObjectProtocol
```

## Overview

The delegate of a [`QLPreviewController`](/documentation/QuickLook/QLPreviewController) object needs to adopt this protocol to:

- Provide a zoom animation for Quick Look previews.
- Specify whether your app opens a URL that the user taps in a preview.
- Respond to the opening or closing of a preview.

The methods described here are optional, but expected.

## Topics

### Responding to preview requests

[`-  previewController:frameForPreviewItem:inSourceView:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewController(_:frameFor:inSourceView:))

Tells the delegate that the system is about to present the preview full screen or dismiss it, and asks for information to provide a zoom effect.

[`-  previewController:transitionImageForPreviewItem:contentRect:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewController(_:transitionImageFor:contentRect:))

Tells the delegate that the system is about to present the preview full screen or dismiss it, and asks for information to provide a smooth transition when zooming.

[`-  previewController:transitionViewForPreviewItem:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewController(_:transitionViewFor:))

Tells the delegate that the system is about to present the preview full screen or dismiss it, and asks for information to provide a smooth transition when zooming.

[`-  previewControllerWillDismiss:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewControllerWillDismiss(_:))

Tells the delegate that the preview is about to close.

[`-  previewControllerDidDismiss:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewControllerDidDismiss(_:))

Tells the delegate that the preview was closed.

### Responding to user actions

[`-  previewController:shouldOpenURL:forPreviewItem:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewController(_:shouldOpen:for:))

Tells the delegate that the preview controller is trying to open a URL.

### Editing the content of a preview

[`-  previewController:editingModeForPreviewItem:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewController(_:editingModeFor:))

Returns a value that indicates how the preview controller handles edits to the content of the previewed file.

[`QLPreviewItemEditingMode`](/documentation/QuickLook/QLPreviewItemEditingMode)

[`-  previewController:didUpdateContentsOfPreviewItem:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewController(_:didUpdateContentsOf:))

Tells the delegate that the content of a preview was updated successfully.

[`-  previewController:didSaveEditedCopyOfPreviewItem:atURL:`](/documentation/QuickLook/QLPreviewControllerDelegate/previewController(_:didSaveEditedCopyOf:at:))

Tells the delegate that the preview item’s edited content was successfully saved to a copy at the given URL.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)