The QLPreviewPanel class implements the Quick Look preview panel—a user interface object that displays the preview of a list of items.


class QLPreviewPanel : NSPanel


Every application has a single shared instance of QLPreviewPanel (see sharedPreviewPanelExists()). The preview panel follows the responder chain and adapts to the first responder willing to control it. A preview panel controller provides the content through methods defined in the QLPreviewPanelDataSource protocol.

You can not subclass QLPreviewPanel; you can, however, customize its behavior using a delegate (see delegate and the QLPreviewPanelDelegate informal protocol).


Accessing the Shared Panel

class func shared() -> QLPreviewPanel!

Returns the shared Quick Look preview panel instance.

class func sharedPreviewPanelExists() -> Bool

Returns a Boolean value that indicates whether the shared Quick Look preview panel instance has been created.

Accessing the Preview Panel Controller

var currentController: Any!

The current first responder accepting to control the preview panel.

func updateController()

Asks the preview panel to update its current controller.

Managing the Preview Items

var dataSource: QLPreviewPanelDataSource!

The preview panel data source.

func reloadData()

Asks the preview panel to reload its data from its data source.

func refreshCurrentPreviewItem()

Asks the preview panel to recompute the preview of the current preview item.

var currentPreviewItemIndex: Int

The index of the current preview item.

var currentPreviewItem: QLPreviewItem!

The currently previewed item.

var displayState: Any!

The preview panel’s display state.

The Panel’s Delegate

var delegate: AnyObject!

The preview panel’s delegate.

Managing Full Screen Mode

func exitFullScreenMode(options: [AnyHashable : Any]!)

Instructs the panel to exit full screen mode.

var isInFullScreenMode: Bool

Indicates whether the panel is in full screen mode.