---
title: "animation(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/viewmodifier/animation(_:)"
---

# animation(_:)

Returns a new version of the modifier that will apply animation to all animatable values within the modifier.

## Declaration

```swift
@MainActor @preconcurrency func animation(_ animation: Animation?) -> some ViewModifier

```

## See Also

### Adding animations to a view

- [concat(_:)](swiftui/viewmodifier/concat(_:).md)
