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

# init(roundedRect:xRadius:yRadius:)

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

```
init(roundedRect rect: NSRect, xRadius: CGFloat, yRadius: CGFloat)
```

## Parameters

`rect`

The rectangle that defines the basic shape of the path.

`xRadius`

The radius of each corner oval along the x-axis. Values larger than half the rectangle’s width are clamped to half the width.

`yRadius`

The radius of each corner oval along the y-axis. Values larger than half the rectangle’s height are clamped to half the height.

## Return Value

A new path object with the rounded rectangular path.

## Discussion

The path is constructed in a counter-clockwise direction, starting at the top-left corner of the rectangle. If either one of the radius parameters contains the value `0.0`, the returned path is a plain rectangle without rounded corners.

## See Also

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

Creates and returns a new Bézier path object.

[`-  appendBezierPathWithRoundedRect:xRadius:yRadius:`](/documentation/AppKit/NSBezierPath/appendRoundedRect(_:xRadius:yRadius:))

Appends a rounded 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)