---
title: "Query(animation:)"
framework: swiftdata
role: symbol
role_heading: Macro
path: "swiftdata/query(animation:)"
---

# Query(animation:)

Fetches all instances of the attached model type, using the specified animation to animate any subsequent changes.

## Declaration

```swift
@attached(accessor) @attached(peer, names: prefixed(`_`)) macro Query(animation: Animation)
```

## Parameters

- `animation`: The animation to use when updates to the fetched models trigger user interface changes.

## See Also

### Basic queries

- [Query(_:animation:sectionBy:)](swiftdata/query(_:animation:sectionby:)-91gkm.md)
- [Query(_:animation:sectionBy:)](swiftdata/query(_:animation:sectionby:)-9futr.md)
- [Query(transaction:)](swiftdata/query(transaction:).md)
- [Query(_:transaction:sectionBy:)](swiftdata/query(_:transaction:sectionby:)-1poj9.md)
- [Query(_:transaction:sectionBy:)](swiftdata/query(_:transaction:sectionby:)-2iol.md)
- [Query(filter:sort:transaction:sectionBy:)](swiftdata/query(filter:sort:transaction:sectionby:)-4wwsy.md)
- [Query(filter:sort:transaction:sectionBy:)](swiftdata/query(filter:sort:transaction:sectionby:)-6qrae.md)
