<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGraphicsRendererContext/stroke(_:blendMode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGraphicsRendererContext(im)strokeRect:blendMode:"
  },
  "title" : "stroke(_:blendMode:)"
}
-->

# stroke(_:blendMode:)

Paints a rectangular path using the currently selected stroke color and specified blend mode.

```
func stroke(_ rect: CGRect, blendMode: CGBlendMode)
```

## Parameters

`rect`

A rectangle, specified in the Core Graphics coordinate space with values in points.

`blendMode`

The blend mode applied to the stroke operation.

## Discussion

Before calling this method, select the stroke color with the [`setStroke()`](/documentation/UIKit/UIColor/setStroke()) method on an instance of [`UIColor`](/documentation/UIKit/UIColor).

The blend mode specifies how the new value for a given pixel is calculated, given the existing pixel value and the currently selected fill color. For more information on the blend modes available, see <doc://com.apple.documentation/documentation/CoreGraphics/CGBlendMode>.

---

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)