Contents

predicateForCategorySamples(with:value:)

Returns a predicate that checks a category sample’s value.

Declaration

class func predicateForCategorySamples(with operatorType: NSComparisonPredicate.Operator, value: Int) -> NSPredicate

Parameters

  • operatorType:

    The type of operation to perform when matching the category sample’s value against the target value. For a list of possible operators, see Contains.

  • value:

    The category sample’s target value. Use an enumeration value appropriate for the type of category samples you are working with. For example, a predicate for sleep analysis samples use values from the Hkcategoryvaluesleepanalysis enumeration.

Return Value

A predicate that matches category samples based on the provided expression. This predicate works only with category samples.

Discussion

Use this convenience method to create a predicate that checks a category sample’s value. The following listing uses both the convenience method and a predicate format string to create equivalent predicates.

See Also

Related Documentation

Creating category sample predicates