HealthKit for iOS8: Part 2

So you got past the intro and learned about the health store and how we need authorization from the user in order to have read and write access to certain properties.  Now that the user trusts your app, let’s learn how to interact with the health store. 1. HKObjects and the health store Before we get into reading and writing, let’s get to know HKObjects.  Here is the class tree: As you can see, HKObjectType inherits directly from NSObject.  You can basically have 2 types of HKObjects; HKCharacteristic and HKSample -Type.  HKCharacteristicType doesn’t change over time whereas HKSampleType does change, such as calories consumed, calories burnt, Glucose levels etc.  Let’s… Read More

Continue Reading

HealthKit for iOS8: Part 1

Intro: What it’s for?   HealthKit is a framework that allows you to store health data to a persistent store on the users device.  We will begin with an app from Part 1 but we will take some detours that are important to understand so bare with me. The first steps are: – Create a tab bar application in Swift for iPhone Only – Rename First and Second view controllers to Profile and Journal and make them UITableViewControllers – In Capabilities turn on HealthKit HealthKit, (HK), requires permissions to access the health store since most of this data is considered confidential.  So to do this, move over to the AppDelegate.swift.… Read More

Continue Reading