Implement the methods of this protocol in the delegate of a QLPreviewController (Quick Look preview controller) object to:


  • Provide a zoom animation for Quick Look previews.

  • Specify whether or not your application opens a URL that the user taps in a preview

  • Respond to the opening or closing of a preview

The delegate of a QLPreviewController object must adopt this protocol. The methods described here are optional but expected.


Responding to Preview Requests

func previewController(QLPreviewController, frameFor: QLPreviewItem, inSourceView: AutoreleasingUnsafeMutablePointer<UIView?>)

Called when a Quick Look preview is about to be presented full screen or dismissed, to provide a zoom effect.

func previewController(QLPreviewController, transitionImageFor: QLPreviewItem, contentRect: UnsafeMutablePointer<CGRect>)

Called when the Quick Look preview controller is about to be presented full screen or dismissed; used to provide a smooth transition when zooming.

func previewControllerWillDismiss(QLPreviewController)

Called before the preview controller is closed.

func previewControllerDidDismiss(QLPreviewController)

Called after the preview controller is closed.

Responding to User Actions

func previewController(QLPreviewController, shouldOpen: URL, for: QLPreviewItem)

Called by the Quick Look preview controller before trying to open a URL.


Inherits From