---
title: filterBy
framework: swiftdata
role: symbol
role_heading: Instance Property
path: swiftdata/resultsobserver/filterby
---

# filterBy

The predicate used to filter which models are included in the results.

## Declaration

```swift
final var filterBy: Predicate<Element>? { get set }
```

## Discussion

Discussion Setting this property updates the underlying fetchDescriptor’s predicate and immediately refetches on the calling actor — results are synchronously up to date before the setter returns. Set to nil to remove filtering and include all models of this type.

## See Also

### Accessing observer properties

- [fetchDescriptor](swiftdata/resultsobserver/fetchdescriptor.md)
- [modelContext](swiftdata/resultsobserver/modelcontext.md)
- [sortBy](swiftdata/resultsobserver/sortby.md)
- [sectionBy](swiftdata/resultsobserver/sectionby.md)
- [sections](swiftdata/resultsobserver/sections.md)
- [ResultsSectionCollection](swiftdata/resultssectioncollection.md)
