A type-erased transition.


@frozen struct AnyTransition


Type Properties

static let identity: AnyTransition

A transition that returns the input view, unmodified, as the output view.

static let opacity: AnyTransition

A transition from transparent to opaque on insertion, and from opaque to transparent on removal.

Instance Methods

func animation(Animation?) -> AnyTransition

Attaches an animation to this transition.

func combined(with: AnyTransition) -> AnyTransition

Combines this transition with another, returning a new transition that is the result of both transitions being applied.

Type Methods

static func asymmetric(insertion: AnyTransition, removal: AnyTransition) -> AnyTransition

Returns a composite transition that uses a different transition for insertion versus removal.

static func modifier<E>(active: E, identity: E) -> AnyTransition

Returns a transition defined between an active modifier and an identity modifier.

static func move(edge: Edge) -> AnyTransition

Returns a transition that moves the view away, towards the specified edge of the view.

See Also


Animating Views and Transitions

When using SwiftUI, you can individually animate changes to views, or to a view’s state, no matter where the effects are. SwiftUI handles all the complexity of these combined, overlapping, and interruptible animations for you.

protocol Animatable

A type for animating views.

protocol AnimatableModifier

A modifier that can create another modifier with animation.

func withAnimation<Result>(Animation?, () -> Result) -> Result

Returns the result of recomputing the view’s body with the provided animation.

struct AnimatablePair

A pair of animatable values, which is itself animatable.

struct EmptyAnimatableData

An empty type for animatable data.