Contents

canPreview(_:)

Returns a Boolean value that indicates whether the preview controller can display an item.

Declaration

class func canPreview(_ item: any QLPreviewItem) -> Bool
class func canPreviewItem(_ item: any QLPreviewItem) -> Bool

Parameters

  • item:

    An item to preview.

Return Value

Returns true if the Quick Look preview controller can display the specified preview item.

Discussion

If the system can’t display an item, but you still attempt to display it, a Quick Look preview controller displays a generic error. Always check whether you can display an item before choosing to do so.

For supported file types, see QLPreviewController.

See Also

Managing item previews