Data types
Specify the kind of data used in HealthKit.
Overview
HealthKit uses HKObjectType subclasses to identify the different types of data stored in HealthKit, from inherent data that doesn’t typically change over time to complex data types that combine multiple samples or compute values over sets of samples.
To create a type object, call the appropriate HKObjectType class method, and pass in the desired type identifier.
let bloodType = HKObjectType.characteristicType(forIdentifier: .bloodType)
let caloriesConsumed = HKObjectType.quantityType(forIdentifier: .dietaryEnergyConsumed)
let sleepAnalysis = HKObjectType.categoryType(forIdentifier: .sleepAnalysis)You can use the resulting object types to request permission to access the data, save new data to the HealthKit store, or read data from the HealthKit store.
Topics
Object type subclasses
HKCharacteristicTypeHKQuantityTypeHKCategoryTypeHKCorrelationTypeHKActivitySummaryTypeHKAudiogramSampleTypeHKElectrocardiogramTypeHKSeriesTypeHKClinicalTypeHKWorkoutTypeHKObjectTypeHKSampleType
Characteristic identifiers
Activity
stepCountdistanceWalkingRunningrunningSpeedrunningStrideLengthrunningPowerrunningGroundContactTimerunningVerticalOscillationdistanceCyclingpushCountdistanceWheelchairswimmingStrokeCountdistanceSwimmingdistanceDownhillSnowSportsbasalEnergyBurnedactiveEnergyBurnedflightsClimbednikeFuelappleExerciseTimeappleMoveTimeappleStandHourappleStandTimevo2MaxlowCardioFitnessEvent
Attachments
Body measurements
Reproductive health
menstrualFlowintermenstrualBleedinginfrequentMenstrualCyclesirregularMenstrualCyclespersistentIntermenstrualBleedingprolongedMenstrualPeriodsbasalBodyTemperaturecervicalMucusQualityovulationTestResultprogesteroneTestResultsexualActivitycontraceptivepregnancypregnancyTestResultlactation
Hearing
environmentalAudioExposureheadphoneAudioExposureenvironmentalAudioExposureEventheadphoneAudioExposureEventaudioExposureEvent
Vital signs
heartRatelowHeartRateEventhighHeartRateEventirregularHeartRhythmEventrestingHeartRateheartRateVariabilitySDNNheartRateRecoveryOneMinuteatrialFibrillationBurdenwalkingHeartRateAverageHKDataTypeIdentifierHeartbeatSeriesHKElectrocardiogramTypeoxygenSaturationbodyTemperaturebloodPressurebloodPressureSystolicbloodPressureDiastolicrespiratoryRate
Nutrition
Alcohol consumption
Mobility
appleWalkingSteadinessappleWalkingSteadinessEventsixMinuteWalkTestDistancewalkingSpeedwalkingStepLengthwalkingAsymmetryPercentagewalkingDoubleSupportPercentagestairAscentSpeedstairDescentSpeed
Symptoms
Lab and test results
bloodAlcoholContentbloodGlucoseelectrodermalActivityforcedExpiratoryVolume1forcedVitalCapacityinhalerUsageinsulinDeliverynumberOfTimesFallenpeakExpiratoryFlowRateperipheralPerfusionIndex
Mindfulness and sleep
mindfulSessionsleepAnalysisappleSleepingWristTemperatureHKAppleSleepingBreathingDisturbancesClassification