Contents

HKCategorySample

A sample with values from a short list of possible values.

Declaration

class HKCategorySample

Mentioned in

Overview

You can use category samples to record data associated with a HKCategoryType. The value for the sample must come from the appropriate category value enumeration. Each category type uses its own enumeration. Individual samples represent a value and time period. Samples with different values may have overlapping time intervals.

The HKCategorySample class is a concrete subclass of the HKSample class. Category samples are immutable: You set the sample’s properties when you create it, and they can’t change.

Extend Category Samples

Like many HealthKit classes, don’t subclass the HKCategorySample class. You may extend the HKCategorySample class by adding metadata with custom keys as appropriate for your app.

For more information, see init(type:value:start:end:metadata:).

Topics

Creating Category Samples

Getting Property Data

Assigning Values

Specifying Predicate Key Paths

Initializers

See Also

Basic samples