<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIStoryboardSegue",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIStoryboardSegue"
  },
  "title" : "UIStoryboardSegue"
}
-->

# UIStoryboardSegue

An object that prepares for and performs the visual transition between two view controllers.

```
@MainActor class UIStoryboardSegue
```

## Overview

The [`UIStoryboardSegue`](/documentation/UIKit/UIStoryboardSegue) class supports the standard visual transitions available in UIKit. You can also subclass to define custom transitions between the view controllers in your storyboard file.

Segue objects contain information about the view controllers involved in a transition. When a segue is triggered, but before the visual transition occurs, the storyboard runtime calls the current view controller’s [`prepare(for:sender:)`](/documentation/UIKit/UIViewController/prepare(for:sender:)) method so that it can pass any needed data to the view controller that’s about to be displayed.

You don’t create segue objects directly. Instead, the storyboard runtime creates them when it must perform a segue between two view controllers. You can still initiate a segue programmatically using the [`performSegue(withIdentifier:sender:)`](/documentation/UIKit/UIViewController/performSegue(withIdentifier:sender:)) method of [`UIViewController`](/documentation/UIKit/UIViewController) if you want. You might do so to initiate a segue from a source that was added programmatically and therefore not available in Interface Builder.

### Subclassing notes

You can subclass [`UIStoryboardSegue`](/documentation/UIKit/UIStoryboardSegue) in situations where you want to provide a custom transition between view controllers in your application. To use your custom segue, create a segue line between the appropriate view controllers in Interface Builder and set its type to Custom in the inspector; you must also specify the class name of the segue to use in the inspector.

When the storyboard runtime detects a custom segue, it creates a new instance of your class, configures it with the view controller objects, asks the view controller source to prepare for the segue, and then performs the segue.

#### Methods to override

For custom segues, the main method you need to override is the [`perform()`](/documentation/UIKit/UIStoryboardSegue/perform()) method. The storyboard runtime calls this method when it’s time to perform the visual transition from the view controller in [`source`](/documentation/UIKit/UIStoryboardSegue/source) to the view controller in [`destination`](/documentation/UIKit/UIStoryboardSegue/destination). If you need to initialize any variables in your custom segue subclass, you can also override the [`init(identifier:source:destination:)`](/documentation/UIKit/UIStoryboardSegue/init(identifier:source:destination:)) method and initialize them in your custom implementation.

#### Alternatives to subclassing

If your segue doesn’t need to store additional information or provide anything other than a [`perform()`](/documentation/UIKit/UIStoryboardSegue/perform()) method, consider using the [`init(identifier:source:destination:performHandler:)`](/documentation/UIKit/UIStoryboardSegue/init(identifier:source:destination:performHandler:)) method instead.

## Topics

### Initializing a storyboard segue

[`init(identifier:source:destination:)`](/documentation/UIKit/UIStoryboardSegue/init(identifier:source:destination:))

Initializes and returns a storyboard segue object for use in performing a segue.

### Accessing the segue attributes

[`source`](/documentation/UIKit/UIStoryboardSegue/source)

The source view controller for the segue.

[`destination`](/documentation/UIKit/UIStoryboardSegue/destination)

The destination view controller for the segue.

[`identifier`](/documentation/UIKit/UIStoryboardSegue/identifier)

The identifier for the segue object.

### Performing the segue

[`perform()`](/documentation/UIKit/UIStoryboardSegue/perform())

Performs the visual transition for the segue.

### Creating a custom segue

[`init(identifier:source:destination:performHandler:)`](/documentation/UIKit/UIStoryboardSegue/init(identifier:source:destination:performHandler:))

Creates a segue that calls a block to perform the segue transition.



---

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)