Class

HKObject

A piece of data that can be stored inside the HealthKit store.

Declaration

class HKObject : NSObject

Overview

The HKObject class is an abstract class. You should never instantiate a HKObject object directly. Instead, always work with one of its concrete subclasses: HKCategorySample, HKQuantitySample, HKCorrelation, or HKWorkout.

HealthKit objects are all immutable. With a few exceptions (such as the object’s source revision), the object’s properties are set when the object is first created and they cannot change.

Topics

Getting Properties

var uuid: UUID

The universally unique identifier (UUID) for this HealthKit object.

var metadata: [String : Any]?

The metadata for this HealthKit object.

var device: HKDevice?

The device that generated the data for this object.

var source: HKSource

A HealthKit source, representing the app or device that created this object.

Deprecated
var sourceRevision: HKSourceRevision

The app or device that created this object.

Predicate Key Paths

let HKPredicateKeyPathUUID: String

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

let HKPredicateKeyPathMetadata: String

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

Relationships

Inherits From

See Also

Abstract Superclasses

class HKSample

A HealthKit sample represents a piece of data associated with a start and end time.