---
title: "electrocardiogram(_:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hksamplepredicate/electrocardiogram(_:)"
---

# electrocardiogram(_:)

Returns a sample predicate that matches electrocardiogram samples.

## Declaration

```swift
static func electrocardiogram(_ predicate: NSPredicate? = nil) -> HKSamplePredicate<HKElectrocardiogram>
```

## Parameters

- `predicate`: An optional predicate that further restricts the results that the query returns.

## Discussion

Discussion Use this method to create an HKSamplePredicate instance that you can use to query for HKElectrocardiogram objects.

## See Also

### Creating Sample Predicates

- [audiogram(_:)](healthkit/hksamplepredicate/audiogram(_:).md)
- [categorySample(type:predicate:)](healthkit/hksamplepredicate/categorysample(type:predicate:).md)
- [clinicalRecord(type:predicate:)](healthkit/hksamplepredicate/clinicalrecord(type:predicate:).md)
- [correlation(type:predicate:)](healthkit/hksamplepredicate/correlation(type:predicate:).md)
- [heartbeatSeries(_:)](healthkit/hksamplepredicate/heartbeatseries(_:).md)
- [quantitySample(type:predicate:)](healthkit/hksamplepredicate/quantitysample(type:predicate:).md)
- [sample(type:predicate:)](healthkit/hksamplepredicate/sample(type:predicate:).md)
- [visionPrescription(_:)](healthkit/hksamplepredicate/visionprescription(_:).md)
- [workout(_:)](healthkit/hksamplepredicate/workout(_:).md)
- [workoutRoute(_:)](healthkit/hksamplepredicate/workoutroute(_:).md)
