<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Path/addRoundedRect(in:cornerSize:style:transform:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4PathV14addRoundedRect2in10cornerSize5style9transformySo6CGRectV_So6CGSizeVAA0E11CornerStyleOSo17CGAffineTransformVtF"
  },
  "title" : "addRoundedRect(in:cornerSize:style:transform:)"
}
-->

# addRoundedRect(in:cornerSize:style:transform:)

Adds a rounded rectangle to the path.

```
mutating func addRoundedRect(in rect: CGRect, cornerSize: CGSize, style: RoundedCornerStyle = .continuous, transform: CGAffineTransform = .identity)
```

## Parameters

`rect`

A rectangle, specified in user space coordinates.

`cornerSize`

The size of the corners, specified in user space
coordinates.

`style`

The corner style. Defaults to the `continous` style
if not specified.

`transform`

An affine transform to apply to the rectangle
before adding to the path. Defaults to the identity
transform if not specified.

## Discussion

This is a convenience function that adds a rounded rectangle to
a path, starting by moving to the center of the right edge and
then adding lines and curves counter-clockwise to create a
rounded rectangle, closing the subpath.

---

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)