---
title: "onEnded(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/gesture/onended(_:)"
---

# onEnded(_:)

Adds an action to perform when the gesture ends.

## Declaration

```swift
nonisolated func onEnded(_ action: @escaping (Self.Value) -> Void) -> _EndedGesture<Self>
```

## Parameters

- `action`: The action to perform when this gesture ends. The action closure’s parameter contains the final value of the gesture.

## Mentioned in

Adding interactivity with gestures

## Return Value

Return Value A gesture that triggers action when the gesture ends.

## Discussion

Discussion important: The action is only performed if the gesture ends successfully. Use a @GestureState property to track state that is reset regardless of how the gesture ends.

## See Also

### Performing the gesture

- [updating(_:body:)](swiftui/gesture/updating(_:body:).md)
- [onChanged(_:)](swiftui/gesture/onchanged(_:).md)
- [Value](swiftui/gesture/value.md)
