Contents

HKCategoryType

A type that identifies samples that contain a value from a small set of possible values.

Declaration

class HKCategoryType

Overview

The HKCategoryType class is a concrete subclass of the HKObjectType class. To create a category type instance, use the init(_:) convenience method. For example, the following code creates a category sample type for handwashing events.

let handwashingCategoryType = HKCategoryType(.handwashingEvent)

Use category types to:

  • Request permission to read or write matching category samples.

  • Create and share matching category samples.

  • Query for matching category samples.

For a complete list of category types, refer to HKCategoryTypeIdentifier.

Topics

Creating Category Types

See Also

Related Documentation

Object type subclasses