---
title: "init(rect:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsbezierpath/init(rect:)"
---

# init(rect:)

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

## Declaration

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

## Parameters

- `rect`: The rectangle describing the path to create.

## Return Value

Return Value A new path object with the rectangular path.

## Discussion

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

## See Also

### Related Documentation

- [fill(_:)](appkit/nsbezierpath/fill(_:).md)
- [stroke(_:)](appkit/nsbezierpath/stroke(_:).md)
- [appendRect(_:)](appkit/nsbezierpath/appendrect(_:).md)

### Creating a Bézier Path

- [init(ovalIn:)](appkit/nsbezierpath/init(ovalin:).md)
- [init(roundedRect:xRadius:yRadius:)](appkit/nsbezierpath/init(roundedrect:xradius:yradius:).md)
- [init(cgPath:)](appkit/nsbezierpath/init(cgpath:)-96cxk.md)
- [flattened](appkit/nsbezierpath/flattened.md)
- [reversed](appkit/nsbezierpath/reversed.md)
