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

# predicateForObjects(with:)

Returns a predicate that matches the objects with the specified  universally unique identifiers (UUIDs).

```
class func predicateForObjects(with UUIDs: Set<UUID>) -> NSPredicate
```

## Parameters

`UUIDs`

The set of UUIDs to be matched.

## Return Value

A predicate that matches the specified objects based on their UUIDs.

## Discussion

HealthKit assigns a UUID to each object when it is saved to the HealthKit store. HealthKit uses these IDs to uniquely identify objects from the store. Use this convenience method to create a predicate that checks an object’s UUID against the provided set of UUIDs. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

```swift
let uuids = HKQuery.predicateForObjectsWithUUIDs(myUUIDs)
 
let explicitUUIDs =
    NSPredicate(format: "%K IN %@", HKPredicateKeyPathUUID, myUUIDs)
```

## See Also

[`HKPredicateKeyPathUUID`](/documentation/HealthKit/HKPredicateKeyPathUUID)

The key path for accessing the object’s UUID inside a predicate format string.

[`UUID`](/documentation/HealthKit/HKObject/uuid)

The universally unique identifier (UUID) for this HealthKit object.



---

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)