---
title: HKObject
framework: healthkit
role: symbol
role_heading: Class
path: healthkit/hkobject
---

# HKObject

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

## Declaration

```swift
class HKObject
```

## Mentioned in

About the HealthKit framework

## Overview

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

### Accessing Properties

- [uuid](healthkit/hkobject/uuid.md)
- [metadata](healthkit/hkobject/metadata.md)
- [device](healthkit/hkobject/device.md)
- [sourceRevision](healthkit/hkobject/sourcerevision.md)
- [source](healthkit/hkobject/source.md)

### Specifying Predicate Key Paths

- [HKPredicateKeyPathUUID](healthkit/hkpredicatekeypathuuid.md)
- [HKPredicateKeyPathMetadata](healthkit/hkpredicatekeypathmetadata.md)

### Initializers

- [init(coder:)](healthkit/hkobject/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [HKSample](healthkit/hksample.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Abstract superclasses

- [HKQuantitySample](healthkit/hkquantitysample.md)
- [HKSample](healthkit/hksample.md)
