---
title: "predicateForObjects(withDeviceProperty:allowedValues:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkquery/predicateforobjects(withdeviceproperty:allowedvalues:)"
---

# predicateForObjects(withDeviceProperty:allowedValues:)

Returns a predicate that matches all objects created by devices with the specified properties.

## Declaration

```swift
class func predicateForObjects(withDeviceProperty key: String, allowedValues: Set<String>) -> NSPredicate
```

## Parameters

- `key`: A string specifying the device’s property. For a list of valid keys, see Valid Device Property Keys.
- `allowedValues`: A set of strings. These strings represent the target property values.

## Return Value

Return Value A predicate that matches all objects created by a device whose specified property matches one of the allowed values.

## Discussion

Discussion Use this convenience method to create a predicate that finds all the objects saved by matching devices. These predicates let you match multiple values for a single property. For example, you can create a single predicate that matches a number of different manufacturer values. The following sample shows how to create a predicate that matches a list of device model names.

## Topics

### Valid Device Property Keys

- [HKDevicePropertyKeyName](healthkit/hkdevicepropertykeyname.md)
- [HKDevicePropertyKeyManufacturer](healthkit/hkdevicepropertykeymanufacturer.md)
- [HKDevicePropertyKeyModel](healthkit/hkdevicepropertykeymodel.md)
- [HKDevicePropertyKeyHardwareVersion](healthkit/hkdevicepropertykeyhardwareversion.md)
- [HKDevicePropertyKeyFirmwareVersion](healthkit/hkdevicepropertykeyfirmwareversion.md)
- [HKDevicePropertyKeySoftwareVersion](healthkit/hkdevicepropertykeysoftwareversion.md)
- [HKDevicePropertyKeyLocalIdentifier](healthkit/hkdevicepropertykeylocalidentifier.md)
- [HKDevicePropertyKeyUDIDeviceIdentifier](healthkit/hkdevicepropertykeyudideviceidentifier.md)

## See Also

### Creating object predicates

- [predicateForObject(with:)](healthkit/hkquery/predicateforobject(with:).md)
- [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(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)
