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”

Tutorial: Core Bluetooth communication with a wearable in Swift 4

The original article – Working with Core Bluetooth in iOS 11 – was published on appcoda.com.

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

As iOS developers, we’re very aware that humans love connectivity. Obviously, we love to communicate with each other using wireless devices. More recently, we’ve come expect that we can communicate with what once were considered standalone, ordinary devices. We’ve come to love, even expect, that some of those wireless devices can gather and analyze data about ourselves (usually “wearables”). So many devices have become intrinsic parts of our lives that we’ve coined a now commonly-used phrase, the “Internet of Things” or “IoT.” There are now billions of wireless, communicable devices on the planet. In this tutorial, we’re going to focus on just one segment of the IoT: Bluetooth®.

I’ll explain the essential concepts behind Bluetooth® technology, show you how getting proficient in Bluetooth® software development presents you with a tremendous career opportunity, remind you that you can’t distribute an app that uses Bluetooth® without determining if you need to go through “qualification,” provide you with an overview of Apple’s Core Bluetooth framework (see also here), and finally, walk you through the development of an iOS app in Swift 4 that monitors a person’s heart rate via Core Bluetooth via a Bluetooth® device.

Continue reading “Tutorial: Core Bluetooth communication with a wearable in Swift 4”