<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQuery/predicateForElectrocardiograms(symptomsStatus:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQuery(cm)predicateForElectrocardiogramsWithSymptomsStatus:"
  },
  "title" : "predicateForElectrocardiograms(symptomsStatus:)"
}
-->

# predicateForElectrocardiograms(symptomsStatus:)

Returns a predicate that matches electrocardiogram samples with the specified symptom status.

```
class func predicateForElectrocardiograms(symptomsStatus: HKElectrocardiogram.SymptomsStatus) -> NSPredicate
```

## Parameters

`symptomsStatus`

The target symptom status.

## Return Value

A predicate that matches electrocardiogram samples with the specified symptom status.

## Discussion

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

```swift
let forSymptomStatus = HKQuery.predicateForElectrocardiograms(symptomsStatus: .present)

let status = HKElectrocardiogram.SymptomsStatus.present.rawValue


let explicitForSymptomStatus = NSPredicate(format: "%K == %d", HKPredicateKeyPathECGSymptomsStatus, status)
```

## See Also

[`let HKPredicateKeyPathECGSymptomsStatus: String`](/documentation/HealthKit/HKPredicateKeyPathECGSymptomsStatus)

The key path for the sample’s symptom status.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)