provideThumbnail(for:_:)
Creates a thumbnail of a custom file type for a specific request.
Declaration
func provideThumbnail(for request: QLFileThumbnailRequest, _ handler: @escaping (QLThumbnailReply?, (any Error)?) -> Void)Parameters
- request:
The request that contains information about the thumbnail that you need to provide, such as the URL to the file.
- handler:
The completion handler to call when you finish creating a thumbnail. Call the completion handler with a Qlthumbnailreply if you can provide a thumbnail or with an Nserror if you can’t create a thumbnail.
The platform doesn’t draw a thumbnail if you pass an
errorto the handler or thereplyisnil.You can call the handler asynchronously after the method has returned.
replyThe object containing information about the thumbnail image that the platform uses to draw the thumbnail.
errorAn error object that indicates why the thumbnail generation failed, or
nilif the thumbnail generation succeeded.
Mentioned in
Discussion
To provide a thumbnail for a custom file type, subclass QLThumbnailProvider, implement this method, and return a QLThumbnailReply that either contains a drawing block or the URL to an image file.