---
title: "predicateForObject(with:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkquery/predicateforobject(with:)"
---

# predicateForObject(with:)

Returns a predicate that matches an object with the specified universally unique identifier (UUID).

## Declaration

```swift
class func predicateForObject(with UUID: UUID) -> NSPredicate
```

## Parameters

- `UUID`: The target UUID.

## Return Value

Return Value A predicate that matches a specific object based on its UUID.

## Discussion

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 matches the object with the provided UUID. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

## See Also

### Related Documentation

- [HKPredicateKeyPathUUID](healthkit/hkpredicatekeypathuuid.md)
- [uuid](healthkit/hkobject/uuid.md)

### Creating object predicates

- [predicateForObjects(with:)](healthkit/hkquery/predicateforobjects(with:).md)
- [predicateForObjects(from:)](healthkit/hkquery/predicateforobjects(from:)-7j3p2.md)
- [predicateForObjects(from:)](healthkit/hkquery/predicateforobjects(from:)-89b4t.md)
- [predicateForObjects(from:)](healthkit/hkquery/predicateforobjects(from:)-9h87f.md)
- [predicateForObjects(withDeviceProperty:allowedValues:)](healthkit/hkquery/predicateforobjects(withdeviceproperty:allowedvalues:).md)
- [predicateForObjects(from:)](healthkit/hkquery/predicateforobjects(from:)-1ar4g.md)
- [predicateForObjects(withMetadataKey:)](healthkit/hkquery/predicateforobjects(withmetadatakey:).md)
- [predicateForObjects(withMetadataKey:allowedValues:)](healthkit/hkquery/predicateforobjects(withmetadatakey:allowedvalues:).md)
- [predicateForObjects(withMetadataKey:operatorType:value:)](healthkit/hkquery/predicateforobjects(withmetadatakey:operatortype:value:).md)
- [predicateForObjectsWithNoCorrelation()](healthkit/hkquery/predicateforobjectswithnocorrelation().md)
