<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftData",
  "identifier" : "/documentation/SwiftData/ResultsObserver/filterBy",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SwiftData"
    ],
    "preciseIdentifier" : "s:9SwiftData15ResultsObserverC8filterBy10Foundation9PredicateVyx_QPGSgvp"
  },
  "title" : "filterBy"
}
-->

# filterBy

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

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

## Discussion

Setting this property updates the underlying [`fetchDescriptor`](/documentation/SwiftData/ResultsObserver/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)