---
title: "heartRate(_:unit:)"
framework: workoutkit
role: symbol
role_heading: Type Method
path: "workoutkit/workoutalert/heartrate(_:unit:)"
---

# heartRate(_:unit:)

Creates a new heart rate alert for the target range.

## Declaration

```swift
static func heartRate(_ range: ClosedRange<Double>, unit: UnitFrequency = WorkoutAlertMetric.countPerMinute) -> Self
```

## Parameters

- `range`: A closed range of heart rate values.
- `unit`: The frequency units used by the range values.

## See Also

### Creating heart rate alerts

- [HeartRateRangeAlert](workoutkit/heartraterangealert.md)
- [heartRate(zone:)](workoutkit/workoutalert/heartrate(zone:).md)
- [HeartRateZoneAlert](workoutkit/heartratezonealert.md)
