Instance Method

animation(_:)

Applies the given animation to all animatable values within this view.

Declaration

func animation(_ animation: Animation?) -> some View

Parameters

animation

The animation to apply to animatable values within this view.

Return Value

A view that wraps this view and applies animation to all animatable values used within the view.

Discussion

Use this modifier on leaf views rather than container views. The animation applies to all child views within this view; calling animation(_:) on a container view can lead to unbounded scope.

See Also

Adding Animations to a View

func animation<V>(Animation?, value: V) -> View

Applies the given animation to this view, whenever the specified value changes.

Beta
func transition(AnyTransition) -> View

Associates a transition with self.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software