init(contextSize:drawing:)
Creates a new thumbnail for a custom file type in the given context.
Declaration
convenience init(contextSize: CGSize, drawing drawingBlock: @escaping (CGContext) -> 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:
The context for drawing the thumbnail. The block takes the following parameter:
- context
A context of type Cgcontext that uses the coordinate system provided by Coregraphics.
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 Core Graphics. If you’re using UIKit or AppKit to draw the thumbnail, use the initializer init(contextSize:currentContextDrawing:). The context that this initializer provides uses the coordinate system of Core Graphics.