Categories used when analyzing sleep samples.


enum HKCategoryValueSleepAnalysis : Int


Each sleep analysis sample can have only one value. To represent the user being both in bed and asleep, HealthKit uses two or more samples with overlapping times.

By comparing the start and end times of these samples, apps can calculate a number of secondary statistics: the amount of time it took for the user to fall asleep, the percentage of time in bed that the user actually spent sleeping, the number of times the user woke while in bed, and the total amount of time spent both in bed and asleep.



case inBed

The user is in bed.

case asleep

The user is sleeping.

case awake

The user is awake.

See Also

Assigning Values

enum HKCategoryValue

Miscellaneous category values.

enum HKCategoryValueCervicalMucusQuality

Categories used to represent the user’s cervical mucus quality.

enum HKCategoryValueMenstrualFlow

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

enum HKCategoryValueOvulationTestResult

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

enum HKCategoryValueAudioExposureEvent

Categories indicating audio exposure events.