Drawing a PaperMarkup synchronously

The PaperMarkup class in PaperKit allows for an asynchronous function called .draw(in:, frame:) that we should call as:

await paperMarkup.draw(in: context.cgContext, frame: rect)

In PencilKit the PKDrawing that we can get from a PKCanvasView allows for .image(from: ,scale:) to be called synchronously. This allows me to easily render into a PKDrawing as a UIImage or a SwiftUI Image to, for example, render a thumbnail on screen.

When trying to incorporate PaperKit in my project I noticed that I often need the drawing to be rendered synchronously (like I would with PKDrawing) but I can't find the way to accomplish this within PaperKit's current functionality.

Is there any way to call .draw(...) in PaperKit synchronously?

Feedback: FB20993683

I just discovered that PKDrawing now lists the same method .draw(in: , frame:) also as asynchronous drawing code. This will only work as of iOS 26 and up.

I wonder if this is going to be the way forward for CGContext drawing code, and if so, how should we treat the block drawing in an async closure.

Take this example from WWDC25 Meet Paperkit:

    // Set up CGContext to render thumbnail in
    let thumbnailSize = CGSize(width: 200, height: 200)
    let context = makeCGContext(size: thumbnailSize)
    context.setFillColor(gray: 1, alpha: 1)
    context.fill(renderer.format.bounds)            

    // Render the PaperKit markup
    await markupModel.draw(in: context, frame: CGRect(origin: .zero, size: thumbnailSize))
    
    thumbnail = context.makeImage()
}
Drawing a PaperMarkup synchronously
 
 
Q