A gesture that recognizes a rotation motion and tracks the angle of the
rotation.
A rotate gesture tracks how a rotation event sequence changes. To
recognize a rotate gesture on a view, create and configure the gesture,
and then add it to the view using the ``View/gesture(_:including:)``
modifier.
Add a rotate gesture to a ``Rectangle`` and apply a rotation effect:
struct RotateGestureView: View {
@State private var angle = Angle(degrees: 0.0)
var rotation: some Gesture {
RotateGesture()
.onChanged { value in
angle = value.rotation
}
}
var body: some View {
Rectangle()
.frame(width: 200, height: 200, alignment: .center)
.rotationEffect(angle)
.gesture(rotation)
}
}
Creates a rotation gesture with a minimum delta for the gesture to
start, and the input kinds the gesture recognizes.
- Parameters:
- minimumAngleDelta: The minimum delta required before the gesture
starts. The default value is a one-degree angle.
- inputKinds: A set of input kinds that this gesture recognizes.
If not specified, the gesture will recognize all applicable input
kinds that a person can use to perform it.
get · iOS 17.0+
minimumAngleDelta
TypeScript
get minimumAngleDelta(): _SwiftUICore_Angle
Swift declaration
var minimumAngleDelta: Angle
The minimum delta required before the gesture succeeds.
set · iOS 17.0+
minimumAngleDelta
TypeScript
set minimumAngleDelta(value: _SwiftUICore_Angle)
Swift declaration
var minimumAngleDelta: Angle
The minimum delta required before the gesture succeeds.
Creates a rotation gesture with a minimum delta for the gesture to
start.
- Parameter minimumAngleDelta: The minimum delta required before the
gesture starts. The default value is a one-degree angle.