TechnologiesSwiftUINavigation

AutomaticNavigationTransition struct

iOSmacOStvOSwatchOSvisionOSiOS 18.0+✓ renders

A style that automatically chooses the appropriate presentation

How it works

AutomaticNavigationTransition is the default transition that SwiftUI applies when a destination is pushed onto or popped from a navigation stack. Rather than committing you to a specific animation, it lets the system choose the most appropriate effect for the current platform, presentation style, and context — including the zoom transition that pairs a tapped source view with its destination when one is available. Reach for it when you want navigation animations that stay consistent with system conventions, or when you want to restore the default behavior after applying a more specific transition elsewhere.

  1. Apply the transition with navigationTransition(_:)

    You don't construct AutomaticNavigationTransition directly; you select it through the navigationTransition(_:) view modifier attached to a navigation destination. In the example, .navigationTransition(.automatic) is placed on the Text("Detail Screen") destination so the push and pop are animated by the system's chosen transition.

  2. Reference it through the .automatic shorthand

    AutomaticNavigationTransition conforms to NavigationTransition, and that protocol exposes a static automatic member so you can write the dotted form .automatic instead of naming the type. This is the value you pass to navigationTransition(_:), as shown by .navigationTransition(.automatic).

  3. Host the destination in a NavigationStack

    A navigation transition only has meaning where SwiftUI drives navigation, so the modifier takes effect on a destination presented inside a stack. Here the NavigationLink("Show Detail") lives in a NavigationStack, and AutomaticNavigationTransition governs how that detail is brought on screen when the link is activated.

  4. Let the system resolve the concrete effect

    Because the transition is automatic, SwiftUI decides at runtime whether to use a standard slide, a zoom, or another platform-appropriate effect — you express intent, not a fixed animation. Applying .automatic to the Text("Detail Screen") view opts that destination into whatever the system considers correct rather than overriding it.

Try it — Replace .navigationTransition(.automatic) with .navigationTransition(.zoom(sourceID: "detail", in: namespace)) (adding a matching .matchedTransitionSource(id:in:) on the link) to see how a specific transition diverges from the system-chosen one.

Example & preview

Press Run live & edit to compile it in your browser — then edit the Swift on the left and the preview re-renders live.

AutomaticNavigationTransition.swift
struct AutomaticNavigationTransitionDemo: View {
    var body: some View {
        NavigationStack {
            NavigationLink("Show Detail") {
                Text("Detail Screen")
                    .font(.title)
                    .navigationTransition(.automatic)
            }
            .padding()
            .navigationTitle("Home")
        }
    }
}
Live preview
Show Detail 9:41 Home
Show Detail 9:41 Home
swift → lexer → parser → sema → uiir → canvas Open in Studio ↗
What's new in SwiftUI 27 →