<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBezierPath/init(rect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBezierPath(cm)bezierPathWithRect:"
  },
  "title" : "init(rect:)"
}
-->

# init(rect:)

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

```
init(rect: NSRect)
```

## Parameters

`rect`

The rectangle describing the path to create.

## Return Value

A new path object with the rectangular path.

## Discussion

The path is constructed by starting at the origin of `aRect` and adding line segments in a counterclockwise direction.

## See Also

[`+  fillRect:`](/documentation/AppKit/NSBezierPath/fill(_:))

Fills the specified rectangular path with the current fill color.

[`+  bezierPath`](/documentation/AppKit/NSBezierPath/bezierPath)

Creates and returns a new Bézier path object.

[`+  strokeRect:`](/documentation/AppKit/NSBezierPath/stroke(_:))

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

[`-  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)