---
title: AnyNavigationTransition
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/anynavigationtransition
---

# AnyNavigationTransition

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

## Declaration

```swift
struct AnyNavigationTransition
```

## Overview

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:) 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)             }         }     } }

## Topics

### Initializers

- [init(_:)](swiftui/anynavigationtransition/init(_:).md)

## Relationships

### Conforms To

- [NavigationTransition](swiftui/navigationtransition.md)

## See Also

### Defining navigation transitions

- [navigationTransition(_:)](swiftui/view/navigationtransition(_:).md)
- [NavigationTransition](swiftui/navigationtransition.md)
- [CrossFadeNavigationTransition](swiftui/crossfadenavigationtransition.md)
