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

# appendRect(_:)

Appends a rectangular path to the path.

```
func appendRect(_ rect: NSRect)
```

## Parameters

`rect`

The rectangle describing the path to create.

## Discussion

Before adding the rectangle, this method moves the current point to the origin of the rectangle, which implicitly closes the current subpath (if any). The path is constructed by starting at the origin of `aRect` and adding line segments in a counterclockwise direction. The final segment is added using a [`close()`](/documentation/AppKit/NSBezierPath/close()) message.

## See Also

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

Fills the specified rectangular path with the current fill color.

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

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

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

Creates and returns a new Bézier path object initialized with a rectangular 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)