<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/GraphicsContext/draw(_:in:)-5opqf",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI15GraphicsContextV4draw_2inyAA4TextV_So6CGRectVtF"
  },
  "title" : "draw(_:in:)"
}
-->

# draw(_:in:)

Draws text into the context using the specified rectangle
as a layout frame.

```
func draw(_ text: Text, in rect: CGRect)
```

## Parameters

`text`

The `Text` view to draw. Before drawing, the method converts
the view to `ResolvedText` by calling `resolve(_:)-4dx65`.

`rect`

The rectangle in the current user space to draw the text in.

## Discussion

The current context state defines the full drawing operation. For
example, the current transformation and clip shapes affect how SwiftUI
draws the text.

---

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)