How to get beat-to-beat measurements's BPM

Using HKHeartbeatSeriesQuery, I am able to get beat-to-beat timestamps. How to get the BPM for those timestamps?


I am able to see the BPM in apple health app.

Accepted Answer
The timestamps represent individual beats, so there isn't really a particular BPM associated with them. If you want the implied BPM by the delta from the previous beat, then you can simply use that timestamp difference to do the calculation yourself. More likely, you'd want to average over some duration or some number of beats to compute a value that changes more smoothly.
How to get beat-to-beat measurements's BPM
 
 
Q