Contents

canPerformUnwindSegueAction(_:from:sender:)

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

Declaration

func canPerformUnwindSegueAction(_ action: Selector, from fromViewController: UIViewController, 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

true if the view controller handles the unwind action, otherwise false.

Discussion

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

The default implementation of this method returns 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 false if the current view controller does not make a suitable return target when unwinding from the specified view controller.

See Also

Performing segues