<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ImageRenderer/render(rasterizationScale:renderer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13ImageRendererC6render18rasterizationScale8renderery14CoreFoundation7CGFloatV_ySo6CGSizeV_ySo12CGContextRefaXEtXEtF"
  },
  "title" : "render(rasterizationScale:renderer:)"
}
-->

# render(rasterizationScale:renderer:)

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

```
@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

Use this method to rasterize the renderer’s content to a
<doc://com.apple.documentation/documentation/CoreGraphics/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)