A protocol for implementing a custom controller to create previews of files.


protocol QLPreviewingController


A controller that implements the QLPreviewingController protocol must at least implement preparePreviewOfSearchableItem(identifier:queryString:completionHandler:) or preparePreviewOfFile(at:completionHandler:).


Creating a Preview

func preparePreviewOfFile(at: URL, completionHandler: (Error?) -> Void)

Prepares the preview of a file at the given file’s URL.

func preparePreviewOfSearchableItem(identifier: String, queryString: String?, completionHandler: (Error?) -> Void)

Prepares the preview for a file by using the data from Spotlight’s searchable item.


Inherits From

See Also

Previews and Thumbails

class QLPreviewController

A specialized view controller for previewing an item.

protocol QLPreviewItem

A protocol that defines properties you implement to make your application’s content visible in a preview.

Previews or Thumbnail Images for macOS 10.14 or Earlier

Create thumbnail images or previews of common files and custom file types on earlier versions of macOS.