---
title: "stroke(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uigraphicsrenderercontext/stroke(_:)"
---

# stroke(_:)

Paints a rectangular path using the currently selected stroke color.

## Declaration

```swift
func stroke(_ rect: CGRect)
```

## Parameters

- `rect`: A rectangle, specified in the Core Graphics coordinate space with values in points.

## Discussion

Discussion Before calling this method, select the stroke color with the setStroke() method on an instance of UIColor. For an example of how to use this method, see Creating an image with an image renderer in UIGraphicsImageRenderer.

## See Also

### Drawing content

- [stroke(_:blendMode:)](uikit/uigraphicsrenderercontext/stroke(_:blendmode:).md)
- [fill(_:blendMode:)](uikit/uigraphicsrenderercontext/fill(_:blendmode:).md)
- [fill(_:)](uikit/uigraphicsrenderercontext/fill(_:).md)
