Instance Method


Performs drawing actions on a Core Graphics context prepared by the renderer.


func runDrawingActions(_ drawingActions: (UIGraphicsRendererContext) -> Void, completionActions: ((UIGraphicsRendererContext) -> Void)? = nil) throws



A UIGraphicsDrawingActions block that represents a set of drawing instructions that the renderer applies to the Core Graphics context.


A UIGraphicsDrawingActions block that the renderer calls after executing the drawingActions block.


A pointer to an NSError object that is populated if there is a problem performing the drawing actions.

Return Value

No return value in Swift.


This method invokes the drawingActions block in a Core Graphics context. This context was created by the context(with:) method, captured in an instance of the class returned by the rendererContextClass() method, and prepared by the prepare(_:with:) method.

Do not override this method. Instead, consider invoking it from a utility method in your subclass, as the UIGraphicsImageRenderer and UIGraphicsPDFRenderer classes do.

See Also

Running the Drawing Actions