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

# Query()

Fetches all instances of the attached model type.

## Declaration

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

## See Also

### Model fetch

- [Filtering and sorting persistent data](swiftdata/filtering-and-sorting-persistent-data.md)
- [Additional query macros](swiftdata/additionalquerymacros.md)
- [Query](swiftdata/query.md)
- [FetchDescriptor](swiftdata/fetchdescriptor.md)
