<!--
{
  "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/Shape/rotation(_:anchor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ShapePAAE8rotation_6anchorAA07RotatedC0VyxGAA5AngleV_AA9UnitPointVtF"
  },
  "title" : "rotation(_:anchor:)"
}
-->

# rotation(_:anchor:)

Rotates this shape around an anchor point at the angle you specify.

```
nonisolated func rotation(_ angle: Angle, anchor: UnitPoint = .center) -> RotatedShape<Self>
```

## Parameters

`angle`

The angle of rotation to apply. Positive angles rotate
clockwise; negative angles rotate counterclockwise.

`anchor`

The point to rotate the shape around.

## Return Value

A rotated shape.

## Discussion

The following example rotates a square by 45 degrees to the right to
create a diamond shape:

```
RoundedRectangle(cornerRadius: 10)
.rotation(Angle(degrees: 45))
.aspectRatio(1.0, contentMode: .fit)
```

---

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)