<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBezierPath/stroke(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBezierPath(cm)strokeRect:"
  },
  "title" : "stroke(_:)"
}
-->

# stroke(_:)

Strokes the path of the specified rectangle using the current stroke color and the default drawing attributes.

```
class func stroke(_ rect: NSRect)
```

## Parameters

`rect`

A rectangle in the current coordinate system.

## Discussion

The path is drawn beginning at the rectangle’s origin and proceeding in a counterclockwise direction. This method strokes the specified path immediately.

## See Also

[`-  set`](/documentation/AppKit/NSColor/set())

Sets the color of subsequent drawing to the color that the color object represents.

[`+  bezierPathWithRect:`](/documentation/AppKit/NSBezierPath/init(rect:))

Creates and returns a new Bézier path object initialized with a rectangular path.

[`-  appendBezierPathWithRect:`](/documentation/AppKit/NSBezierPath/appendRect(_:))

Appends a rectangular path to the path.



---

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)