<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQuery/predicateForObjects(from:)-1ar4g",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQuery(cm)predicateForObjectsFromSourceRevisions:"
  },
  "title" : "predicateForObjects(from:)"
}
-->

# predicateForObjects(from:)

Returns a predicate that matches all the objects that were created by any of the provided source revisions.

```
class func predicateForObjects(from sourceRevisions: Set<HKSourceRevision>) -> NSPredicate
```

## Parameters

`sourceRevisions`

A set of source revisions that have saved data to the HealthKit store.

## Return Value

A predicate that matches all the objects created by any of the provided source revisions.

## Discussion

The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

```swift
let fromSourceRevisions = HKQuery.predicateForObjectsFromSourceRevisions(sourceRevisions)
 
let explicitFromSourceRevisions = NSPredicate(format: "%K IN %@", HKPredicateKeyPathSourceRevision, sourceRevisions)
```

---

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)