Contents

predicateForElectrocardiograms(classification:)

Returns a predicate that matches electrocardiogram samples with the specified classification.

Declaration

class func predicateForElectrocardiograms(classification: HKElectrocardiogram.Classification) -> NSPredicate

Parameters

  • classification:

    The target classification.

Return Value

A predicate that matches electrocardiogram samples with the specified classification.

Discussion

Use this convenience method to create a predicate that matches electrocardiogram samples with the specified classification. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

let forClassification = HKQuery.predicateForElectrocardiograms(classification: .atrialFibrillation)

let classification = HKElectrocardiogram.Classification.atrialFibrillation.rawValue

let explicitForClassification = NSPredicate(format: "%K == %d", HKPredicateKeyPathECGClassification, classification)

See Also

Related Documentation

Creating electrocardiogram predicates