Contents

predicateForObjects(withDeviceProperty:allowedValues:)

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

Declaration

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

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

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

See Also

Creating object predicates