<!--
{
  "availability" : [
    "Xcode: 16.3.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "XCUIAutomation",
  "identifier" : "/documentation/XCUIAutomation/XCUIElement/rotate(_:withVelocity:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XCUIAutomation"
    ],
    "preciseIdentifier" : "c:objc(cs)XCUIElement(im)rotate:withVelocity:"
  },
  "title" : "rotate(_:withVelocity:)"
}
-->

# rotate(_:withVelocity:)

Sends a rotation gesture with two touches.

```
func rotate(_ rotation: CGFloat, withVelocity velocity: CGFloat)
```

## Parameters

`rotation`

The rotation of the gesture in radians.

`velocity`

The velocity of the rotation gesture in radians per second.

## Discussion

The system makes a best effort to synthesize the requested rotation and velocity, but absolute accuracy isn’t guaranteed. Some values may not be possible based on the size of the element’s frame, and they result in test failures.

---

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)