Contents

providePreview(for:completionHandler:)

Declaration

optional func providePreview(for request: QLFilePreviewRequest, completionHandler handler: @escaping  @Sendable (QLPreviewReply?, (any Error)?) -> Void)
optional func providePreview(for request: QLFilePreviewRequest) async throws -> QLPreviewReply

Parameters

  • request:

    An object which contains information about the preview that should be provided. It contains the URL of the file to provide a preview for.

  • handler:

    Call the completion handler with a QLPreviewReply if you can provide a preview, or with an NSError if you cannot. If an error is passed or reply is nil, a generic preview will be provided instead. The handler can be called asynchronously after the method has returned.

Discussion

Use this method to provide a QLPreviewReply that provides preview in the form of NSData, NSURL, PDFDocument, or a drawing into a context.