<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/AnyNavigationTransition",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI23AnyNavigationTransitionV"
  },
  "title" : "AnyNavigationTransition"
}
-->

# AnyNavigationTransition

A type-erasing navigation transition that allows for providing any
navigation transition value dynamically.

```
struct AnyNavigationTransition
```

## Overview

Use this navigation transition when you need to dynamically configure the
transition of your content. For example, you could use this in a
[`sheet(isPresented:onDismiss:content:)`](/documentation/SwiftUI/View/sheet(isPresented:onDismiss:content:)) modifier to dynamically
configure how the sheet transitions in and out.

This example shows a sheet that uses a different transition based on
model state.

```
struct ContentView: View {
    @State private var showSheet = false
    @Environment(Model.self) var model

    var body: some View {
        VStack {
            Button("Show Sheet") {
                showSheet = true
            }
            .sheet(isPresented: $showSheet) {
                let transition = model.useCrossDissolve
                    ? AnyNavigationTransition(.crossFade)
                    : AnyNavigationTransition(.automatic)
                Text("Sheet Content")
                    .presentationDetents([.medium])
                    .navigationTransition(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)