<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKHeartbeatSeriesBuilder/addHeartbeatWithTimeInterval(sinceSeriesStartDate:precededByGap:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKHeartbeatSeriesBuilder(im)addHeartbeatWithTimeIntervalSinceSeriesStartDate:precededByGap:completion:"
  },
  "title" : "addHeartbeatWithTimeInterval(sinceSeriesStartDate:precededByGap:completion:)"
}
-->

# addHeartbeatWithTimeInterval(sinceSeriesStartDate:precededByGap:completion:)

Adds a heartbeat to the series.

```
func addHeartbeatWithTimeInterval(sinceSeriesStartDate timeIntervalSinceStart: TimeInterval, precededByGap: Bool, completion: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

## Parameters

`timeIntervalSinceStart`

The time of the heartbeat, measured from the series builder’s start date. This must be a positive value.

`precededByGap`

A Boolean value that indicates whether this heartbeat was immediately preceded by a gap in the data, indicating that one or more heartbeats may be missing.

`completion`

The completion handler called by the builder after it attempts to add the heartbeat to the series. The completion handler takes the following parameters:

- `success`: A Boolean value that indicates whether the builder successfully added the heartbeat.
- `error`: If the `success` parameter is <doc://com.apple.documentation/documentation/Foundation/NSExpression/false>, this contains an object that describes the error; otherwise, `nil`.

---

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)