Introduction to iOS HealthKit with Core Bluetooth using Swift 4

My original article — Introduction to HealthKit with Core Bluetooth — was published on appcoda.com.

[Download the Xcode 9 project from GitHub so you can follow along with my code explanation and try iOS HealthKit features yourself!]

In a previous tutorial, I discussed the technology, applications, and benefits of Apple’s Core Bluetooth framework. I showed you how to build an app that wirelessly connected to a Bluetooth® heart rate monitor (HRM) — a small, portable, and “wearable” device. My sample app’s code read heart rate data from the HRM, but it didn’t do anything with the heart rate data except display it in real-time on an iPhone’s screen. While edifying and interesting, there are already a bazillion apps in the App Store that can read heart rate data, and other wearable data, using Core Bluetooth. What about doing something interesting with that data, like analyzing it, deriving value-added and meaningful results from it, and sharing it with researchers? That’s where Apple’s HealthKit framework shines. Please download the Xcode 9 project written is Swift 4 so you can follow along with my discussion.

Continue reading “Introduction to iOS HealthKit with Core Bluetooth using Swift 4”