Health​Kit Constants

Overview

This document defines constants in the HealthKit framework that are not associated with a particular class.

Symbols

Metadata Keys and Values

Predefined keys and values. Use these constants to store metadata so that it can be shared with other apps.

Metadata Keys

A set of predefined keys for adding metadata to HealthKit objects. Use these keys to facilitate sharing data between apps. You can also create your own custom keys to give HealthKit objects additional app-specific data.

HKBody​Temperature​Sensor​Location

Constants that indicate where on the body a temperature reading was taken.

HKHeart​Rate​Sensor​Location

Constants that indicate where on the body the heart rate sensor is located.

HKWeather​Condition

Constants that indicate a type of weather.

Type Identifiers

Constant values used to specify both the type of sample (quantity, category, characteristic, correlation, or workout) and the value being measured. Use these constants to create HKObject​Type objects.

Body Measurements

Identifiers for quantity types based on body measurements.

Fitness Identifiers

Identifiers for quantity types that measure fitness data.

Vital Signs Identifiers

Identifiers for quantity types that measure the user’s vital signs.

Results Identifiers

Identifiers for quantity types that measure results data.

Nutrition Identifiers

Identifiers for quantity types that measure the nutritional data of food. When entering food data, combine multiple nutrition samples into a single correlation object. For more information, see food.

UV Exposure Identifier

An identifier for quantity types that measure the user’s exposure to ultraviolet (UV) radiation.

Category Type Identifiers

Identifiers for category types.

Characteristics Type Identifiers

Identifiers for characteristic types.

Correlation Type Identifiers

Identifiers for correlation types.

Workout Type Identifier

An identifier for workout types.

Document Type Identifier

An identifier for continuity of care document (CDA) types

Workout Constants

Constants used to define workout samples and workout sessions.

HKWorkout​Activity​Type

The type of activity performed during a workout.

HKWorkout​Session​State
HKWorkout​Session​Location​Type

A constant indicating whether the workout session takes place indoors or outdoors.

Other HealthKit Constants

Other constants used by Health Kit.

Health Kit Error Domain

Constant for the HealthKit error domain.

HKError.Code

Error codes that may be returned when calling HealthKit methods.

HKUpdate​Frequency

Constants that determine how often the system will launch your app in response to changes to HealthKit data. For more information, see HKObserver​Query.

HKAuthorization​Status

Constants indicating the authorization status for a particular data type.

HKFitzpatrick​Skin​Type

Categories representing the user’s skin type based on the Fitzpatrick scale. The Fitzpatrick scale is a numerical classification for skin color based on the skins response to sun exposure in terms of the degree of burning and tanning.

HKCategory​Value​Sleep​Analysis

Categories used when analyzing sleep samples.

HKCategory​Value​Apple​Stand​Hour

Categories used to indicate whether the user stood during the sample’s duration.

HKCategory​Value​Cervical​Mucus​Quality

Categories used to represent the user’s cervical mucus quality. These values are ordered from least-fertile (Dry) to most-fertile (EggWhite).

HKCategory​Value​Ovulation​Test​Result

Categories used to represent the result of an ovulation home test.

HKCategory​Value​Menstrual​Flow

Constants indicating the amount of menstrual flow for a given sample.

HKCategory​Value

Miscellaneous category values.

HKBiological​Sex

Constants indicating the user’s sex. A person's sex is a combination of bodily characteristics including: chromosomes, hormones, internal and external reproductive organs, and secondary sex characteristics.

HKBlood​Type

Constants indicating the user’s blood type.

HKWheelchair​Use

Constants indicating the user’s wheelchair use.

Constants

var HKAnchored​Object​Query​No​Anchor:​ Int32

Use this constant to define an anchored object query that returns all of the matching samples currently in the HealthKit store.

let HKDetailed​CDAValidation​Error​Key:​ String

A key for accessing validation error information from an NSError object’s user​Info dictionary.

let HKDevice​Property​Key​Local​Identifier:​ String

A unique identifier for the device on the hardware running the app. For more information, see local​Identifier.

let HKMetadata​Key​Lap​Length:​ Stringlet HKMetadata​Key​Swimming​Location​Type:​ Stringlet HKMetadata​Key​Swimming​Stroke​Style:​ String
let HKObject​Query​No​Limit:​ Int

The query returns all the samples in the HealthKit store that match the given sample type and predicate.

let HKPredicate​Key​Path​CDAAuthor​Name:​ String

The key path for accessing the author’s name inside a predicate format string.

let HKPredicate​Key​Path​CDACustodian​Name:​ String

The key path for accessing the custodian’s name inside a predicate format string.

let HKPredicate​Key​Path​CDAPatient​Name:​ String

The key path for accessing the patient’s name inside a predicate format string.

let HKPredicate​Key​Path​CDATitle:​ String

The key path for accessing the document’s title inside a predicate format string.

let HKPredicate​Key​Path​Category​Value:​ String

The key path for the category sample’s value.

let HKPredicate​Key​Path​Correlation:​ String

The key path for accessing the object’s correlation inside a predicate format string.

let HKPredicate​Key​Path​Date​Components:​ String

A key path for the summary’s date components.

let HKPredicate​Key​Path​Device:​ String

The key path for accessing the object’s device inside a predicate format string.

let HKPredicate​Key​Path​End​Date:​ String

The key path for the sample’s end date.

let HKPredicate​Key​Path​Metadata:​ String

The key path for accessing the object’s metadata dictionary inside a predicate format string.

let HKPredicate​Key​Path​Quantity:​ String

The key path to the sample’s quantity.

let HKPredicate​Key​Path​Source:​ String

The key path for accessing the object’s source inside a predicate format string.

let HKPredicate​Key​Path​Source​Revision:​ String

The key path for accessing the object’s source revision inside a predicate format string.

let HKPredicate​Key​Path​Start​Date:​ String

The key path for the sample’s start date.

let HKPredicate​Key​Path​UUID:​ String

The key path for accessing the object’s UUID inside a predicate format string.

let HKPredicate​Key​Path​Workout:​ String

The key path for accessing the object’s workout inside a predicate format string.

let HKPredicate​Key​Path​Workout​Duration:​ String

The key path for the workout’s duration.

let HKPredicate​Key​Path​Workout​Total​Distance:​ String

The key path for the workout’s total distance.

let HKPredicate​Key​Path​Workout​Total​Energy​Burned:​ String

The key path for the workout’s total energy burned.

let HKPredicate​Key​Path​Workout​Total​Swimming​Stroke​Count:​ String
let HKPredicate​Key​Path​Workout​Type:​ String

The key path for the workout’s type.

let HKSample​Sort​Identifier​End​Date:​ String

A constant for sorting samples based on their end date.

let HKSample​Sort​Identifier​Start​Date:​ String

A constant for sorting samples based on their start date.

var HKUnit​Molar​Mass​Blood​Glucose:​ Double

The molecular mass of blood glucose, typically used to create mole units for blood glucose.

let HKWorkout​Sort​Identifier​Duration:​ String

A constant for sorting workouts based on their duration.

let HKWorkout​Sort​Identifier​Total​Distance:​ String

A constant for sorting workouts based on their total distance.

let HKWorkout​Sort​Identifier​Total​Energy​Burned:​ String

A constant for sorting workouts based on the total energy burned.

let HKWorkout​Sort​Identifier​Total​Swimming​Stroke​Count:​ String