---
title: "shouldPerformSegue(withIdentifier:sender:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/shouldperformsegue(withidentifier:sender:)"
---

# shouldPerformSegue(withIdentifier:sender:)

Determines whether the segue with the specified identifier should be performed.

## Declaration

```swift
func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool
```

## Parameters

- `identifier`: The string that identifies the triggered segue. In Interface Builder, you specify the segue’s identifier string in the attributes inspector. This string is used only for locating the segue inside the storyboard.
- `sender`: The object that initiated the segue. This object is made available for informational purposes during the actual segue.

## Mentioned in

Customizing the behavior of segue-based presentations

## Return Value

Return Value true if the segue should be performed or false if it should be ignored.

## Discussion

Discussion Subclasses can override this method and use it to perform segues conditionally based on current conditions. If you do not implement this method, all segues are performed.

## See Also

### Performing segues

- [prepare(for:sender:)](uikit/uiviewcontroller/prepare(for:sender:).md)
- [performSegue(withIdentifier:sender:)](uikit/uiviewcontroller/performsegue(withidentifier:sender:).md)
- [allowedChildrenForUnwinding(from:)](uikit/uiviewcontroller/allowedchildrenforunwinding(from:).md)
- [childContaining(_:)](uikit/uiviewcontroller/childcontaining(_:).md)
- [canPerformUnwindSegueAction(_:from:sender:)](uikit/uiviewcontroller/canperformunwindsegueaction(_:from:sender:).md)
- [unwind(for:towards:)](uikit/uiviewcontroller/unwind(for:towards:).md)
