Compose SwiftUIv0.4.0
esc
GuideAPIGitHub
View modifier

animation(_:)

Animates changes of a value in a view.

iOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+
fun Modifier.animation(animation: Animation?): Modifier

Overview

To animate a state change made in Kotlin, wrap it in withAnimation(Animation.spring) { … }.

Modifier.animation(animation = Animation.…)

This is the Kotlin form of SwiftUI View.animation(_:): SwiftUI documentation. In Swift it reads:

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

Topics

Overloads

fun Modifier.animation(animation: Animation?, value: Any): Modifier
SwiftUI View.animation(_:value:)
fun Modifier.animation(animation: Animation?): Modifier
SwiftUI View.animation(_:)