Pulse is a simple library that provides a delegate method for changing heart rates from an attached Bluetooth heart rate monitor using Bluetooth LE.
To use Pulse, simply use the singleton to create a new instance.
let pulse = Pulse.sharedInstance
pulse.delegate = self
pulse.startListening()
Once Bluetooth is listening for devices, you can then keep up with the changes in heart rate through the delegate:
extension ViewController: PulseDelegate {
func manager(didUpdate bpm: Int) {
label.text = "BPM: \(bpm)"
}
}
Check out the Xcode project for a complete example.
Copy the source from the Pulse folder to your project.
I was first exposed to the intricacies of CoreBluetooth when I was working on another project of mine. Wanting to figure out how to use this technology with a heart rate monitor, I found this excellent tutorial on Ray Wenderlich written by Jawwad Ahmad and Steven Daniel.
Pulse simply builds upon their work, abstracting the project into a standalone library with a few modifications.