Apple HealthKit and accessing its Clinical records and Health data


Enable the required entitlements. Open the Capabilities tab in the target editor, and turn on the HealthKit switch.


HealthKit deals with sensitive and private data.

Authorize HealthKit

The method below accepts no parameters, and it has a completion handler that returns a boolean (success or failure) and an optional error in case something goes wrong.

  1. Check to see if Healthkit is available on this device. If it isn’t, complete with failure and an error.
  2. Prepare the types of health data our app will read or write from HealthKit.
  3. Organize those data into a list of types to be read and types to be written.
  4. Request Authorization — if it’s successful, complete with success.

Preparing Data Types

HealthKit has many data types, refer them here: kit/data_types.

Read and write the Data

Make a list of data you want to read and write. Remember, clinical records are read-only, hence only health data will be written as well as read.

Authorize Data

Final Step!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store