init(contextSize:currentContextDrawing:)
Creates a new thumbnail for a custom file type in the current context.
Declaration
convenience init(contextSize: CGSize, currentContextDrawing drawingBlock: @escaping () -> Bool)Parameters
- contextSize:
The desired size of the context that you pass to the drawing block. Set this value as close as possible to the Qlfilethumbnailrequest class’s Maximumsize value and greater than or equal to its Minimumsize value.
This parameter indicates the preferred size of the thumbnail. The context’s width or its height matches the
widthorheightof the Maximumsize, or, ideally, both.The system scales the context size to the Qlfilethumbnailrequest class’s Scale property. For example, if you pass a
contextSizeofCGSize(10, 10)to this method, the size of the context is(scale * 10, scale * 10). - drawingBlock:
A block that draws the thumbnail into the current bitmap Cgcontext that’s accessible using Uigraphicsgetcurrentcontext() or, if you’re developing for macOS,
NSGraphicsContext.current. Use the context with the coordinate system of Uikit or Appkit.Return True if you successfully drew the thumbnail into the context. Return False otherwise.
Return Value
An initialized reply object for a requested thumbnail.
Discussion
Use this initializer if you’re drawing the thumbnail using UIKit or AppKit. If you’re using CoreGraphics to draw the thumbnail, use init(contextSize:drawing:). The context that this initializer provides uses the coordinate system of UIKit or AppKit, depending on the platform.