API Reference

This page provides a reference for the built-in transitions and options available in SwiftUINavigationTransitions.

Built-in Transitions

These transitions are available as static properties on AnyNavigationTransition.

default

The standard, platform-default navigation transition. Use this when you want to customize interactivity without changing the visual animation.

.navigationTransition(.default, interactivity: .pan)

fade(_: Style)

A transition that fades views in or out.

Styles: - .in: Fades the incoming view in, while the outgoing view stays put. - .out: Fades the outgoing view out, while the incoming view is immediately visible. - .cross: Cross-fades the incoming and outgoing views.

Example:

.navigationTransition(.fade(.cross))

slide(axis: Axis)

A transition that slides views horizontally or vertically.

Axes: - .horizontal (default): Pushes views from right to left, and pops from left to right. - .vertical: Pushes views from bottom to top, and pops from top to bottom.

Examples:

// Horizontal slide
.navigationTransition(.slide)

// Vertical slide
.navigationTransition(.slide(axis: .vertical))

Other Examples

The demo application showcases how to build more advanced transitions like .flip, .swing, and .zoom. See the Creating Custom Transitions guide for details on how these are built.

Interactivity Options

The interactivity parameter of the .navigationTransition() modifier controls the behavior of the interactive pop gesture.

  • .disabled: Disables the swipe-to-pop gesture.
  • .edgePan: The default. The gesture is recognized only from the leading edge of the screen.
  • .pan: The gesture is recognized from anywhere on the screen, enabling a full-screen pop.