---
title: "render(rasterizationScale:renderer:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/imagerenderer/render(rasterizationscale:renderer:)"
---

# render(rasterizationScale:renderer:)

Draws the renderer’s current contents to an arbitrary Core Graphics context.

## Declaration

```swift
@MainActor final func render(rasterizationScale: CGFloat = 1, renderer: (CGSize, (CGContext) -> Void) -> Void)
```

## Parameters

- `rasterizationScale`: The scale factor for converting user interface points to pixels when rasterizing parts of the view that can’t be represented as native Core Graphics drawing commands.
- `renderer`: The closure that sets up the Core Graphics context and renders the view. This closure receives two parameters: the size of the view and a function that you invoke in the closure to render the view at the reported size. This function takes a doc://com.apple.documentation/documentation/CoreGraphics/CGContext parameter, and assumes a bottom-left coordinate space origin.

## Discussion

Discussion Use this method to rasterize the renderer’s content to a CGContext you provide. The renderer closure receives two parameters: the current size of the view, and a function that renders the view to your CGContext. Implement the closure to provide a suitable CGContext, then invoke the function to render the content to that context.

## See Also

### Rendering images

- [cgImage](swiftui/imagerenderer/cgimage.md)
- [nsImage](swiftui/imagerenderer/nsimage.md)
- [uiImage](swiftui/imagerenderer/uiimage.md)
