---
title: "forUnwindSegueAction(_:from:withSender:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/forunwindsegueaction(_:from:withsender:)"
---

# forUnwindSegueAction(_:from:withSender:)

Called when an unwind segue action wants to search a container’s children for a view controller to handle the unwind action.

## Declaration

```swift
func forUnwindSegueAction(_ action: Selector, from fromViewController: UIViewController, withSender sender: Any?) -> UIViewController?
```

## Parameters

- `action`: The action that triggered the unwind action.
- `fromViewController`: The view controller that is the source of the unwinding action.
- `sender`: The object that initiated the action.

## Return Value

Return Value The view controller that wants to handle the unwind action.

## Discussion

Discussion A custom container view controller should override this method and use it to search its children for a view controller to handle the unwind action. It does this by invoking the canPerformUnwindSegueAction(_:from:withSender:) method on each child. If a view controller wants to handle the action, your method should return it. If none of the container’s children want to handle the unwind action, invoke the super’s implementation and return the result of that method.

## See Also

### Deprecated methods

- [setOverrideTraitCollection(_:forChild:)](uikit/uiviewcontroller/setoverridetraitcollection(_:forchild:).md)
- [overrideTraitCollection(forChild:)](uikit/uiviewcontroller/overridetraitcollection(forchild:).md)
- [attemptRotationToDeviceOrientation()](uikit/uiviewcontroller/attemptrotationtodeviceorientation().md)
- [registerForPreviewing(with:sourceView:)](uikit/uiviewcontroller/registerforpreviewing(with:sourceview:).md)
- [unregisterForPreviewing(withContext:)](uikit/uiviewcontroller/unregisterforpreviewing(withcontext:).md)
- [canPerformUnwindSegueAction(_:from:withSender:)](uikit/uiviewcontroller/canperformunwindsegueaction(_:from:withsender:).md)
- [didRotate(from:)](uikit/uiviewcontroller/didrotate(from:).md)
- [dismissMoviePlayerViewControllerAnimated()](uikit/uiviewcontroller/dismissmovieplayerviewcontrolleranimated().md)
- [presentMoviePlayerViewControllerAnimated(_:)](uikit/uiviewcontroller/presentmovieplayerviewcontrolleranimated(_:).md)
- [rotatingFooterView()](uikit/uiviewcontroller/rotatingfooterview().md)
- [rotatingHeaderView()](uikit/uiviewcontroller/rotatingheaderview().md)
- [segueForUnwinding(to:from:identifier:)](uikit/uiviewcontroller/segueforunwinding(to:from:identifier:).md)
- [shouldAutomaticallyForwardRotationMethods()](uikit/uiviewcontroller/shouldautomaticallyforwardrotationmethods().md)
- [willAnimateRotation(to:duration:)](uikit/uiviewcontroller/willanimaterotation(to:duration:).md)
- [willRotate(to:duration:)](uikit/uiviewcontroller/willrotate(to:duration:).md)
