watchOS 2 Heart Rate Sensor

3.9k views Asked by At

Does anyone know how to access the heart rate sensor available in watchOS 2 in Xcode 7 beta?

3

There are 3 answers

0
John On

watchOS 2 allows you to use HealthKit. Within this kit, you may use HKWorkout to access variables such as the heart rate.

2
Seyed Parsa Neshaei On

Many of software kits for iOS are now available for watchOS, such as HealthKit.

You can use HealthKit (HK) functions and classes in order to calculate burned calories, find heart rate, etc.

You can use HKWorkout to calculate everything about workouts and access the related variables such as heart rate, just like you did with iOS before.

Read developer documentations from Apple in order to learn about HealthKit. They can be found in developer.apple.com.

Resources

For more details about HKWorkout, you should check out the HKWorkout Class Reference and the HKWorkoutSession Class Reference from Apple.

Also don't forget to check out this great WWDC15 video.

0
lehn0058 On

Apple isn't technically giving developers access to the heart rate sensors in watchOS 2.0. What they are doing is providing direct access to heart rate data recorded by the sensor in HealthKit. See the stack overflow answer to this question for more detail.