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

# onEnded(_:)

Adds an action to perform when the gesture ends.

```
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.

## Return Value

A gesture that triggers `action` when the gesture ends.

## 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.

---

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)