<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIViewController/shouldPerformSegue(withIdentifier:sender:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIViewController(im)shouldPerformSegueWithIdentifier:sender:"
  },
  "title" : "shouldPerformSegue(withIdentifier:sender:)"
}
-->

# shouldPerformSegue(withIdentifier:sender:)

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

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

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the segue should be performed or <doc://com.apple.documentation/documentation/Swift/false> if it should be ignored.

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

---

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)