---
title: "performSegue(withIdentifier:sender:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssegueperforming/performsegue(withidentifier:sender:)"
---

# performSegue(withIdentifier:sender:)

Performs the specified segue.

## Declaration

```swift
@MainActor optional func performSegue(withIdentifier identifier: NSStoryboardSegue.Identifier, sender: Any?)
```

## Parameters

- `identifier`: The string that uniquely identifies the segue in the storyboard file. In Interface Builder, you can provide an identifier string to a segue using the inspector. Pass this string to this parameter. note: This method throws an https://developer.apple.com/library/archive/documentation/General/Conceptual/DevPedia-CocoaCore/ExceptionHandling.html#//apple_ref/doc/uid/TP40008195-CH18 if there is no segue with the specified identifier or if the identifier is nil.
- `sender`: The object that you want to use to initiate the segue. This parameter makes the object available to your implementation during the segue.

## Discussion

Discussion Apps typically do not need to trigger segues programmatically. If needed, you can call this method to trigger a segue for an action that cannot be expressed in a storyboard file, such as a transition between scenes in different storyboards. Typically, a segue is triggered by a user action, such as clicking a button. In Interface Builder, configure an object, such as a control embedded in the view controller’s view hierarchy, to trigger the segue.

## See Also

### Working with Storyboard Segues

- [prepare(for:sender:)](appkit/nssegueperforming/prepare(for:sender:).md)
- [shouldPerformSegue(withIdentifier:sender:)](appkit/nssegueperforming/shouldperformsegue(withidentifier:sender:).md)
