<!--
{
  "availability" : [
    "iOS: 6.0.0 - 13.0.0",
    "iPadOS: 6.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "tvOS: 9.0.0 - 13.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIViewController/canPerformUnwindSegueAction(_:from:withSender:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIViewController(im)canPerformUnwindSegueAction:fromViewController:withSender:"
  },
  "title" : "canPerformUnwindSegueAction(_:from:withSender:)"
}
-->

# canPerformUnwindSegueAction(_:from:withSender:)

Called on a view controller to determine whether it wants to respond to an unwind action.

```
func canPerformUnwindSegueAction(_ action: Selector, from fromViewController: UIViewController, withSender sender: Any) -> Bool
```

## Parameters

`action`

The unwind action to invoke on your view controller.

`fromViewController`

The view controller that initiated the unwind action.

`sender`

The object that triggered the action.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the view controller wants to handle the unwind action, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

When an unwind segue is triggered, UIKit uses this method and the [`allowedChildrenForUnwinding(from:)`](/documentation/UIKit/UIViewController/allowedChildrenForUnwinding(from:)) method to locate a suitable view controller to handle the unwind segue.

The default implementation of this method returns <doc://com.apple.documentation/documentation/Swift/true> when the current view controller implements the `action` method and is not the same view controller as the one in the `fromViewController` parameter. You can override this method as needed to change the default behavior. For example, you might return <doc://com.apple.documentation/documentation/Swift/false> if the current view controller does not make a suitable return target when unwinding from the specified view controller.

---

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)