<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKSourceRevision",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKSourceRevision"
  },
  "title" : "HKSourceRevision"
}
-->

# HKSourceRevision

An object indicating the source of a HealthKit sample.

```
class HKSourceRevision
```

## Overview

The [`HKSourceRevision`](/documentation/HealthKit/HKSourceRevision) class acts as a wrapper for the [`HKSource`](/documentation/HealthKit/HKSource) class, adding information about the source’s version, operating system, and product type.

Source revision objects are immutable: you set the source revision’s properties when you create the object, and they cannot change.

When an [`HKObject`](/documentation/HealthKit/HKObject) instance is created, its [`sourceRevision`](/documentation/HealthKit/HKObject/sourceRevision) property is set to `nil`. When the object is saved to the HealthKit store, HealthKit assigns a new source revision to the object’s [`sourceRevision`](/documentation/HealthKit/HKObject/sourceRevision) property. The source revision can be accessed only on objects retrieved from the HealthKit store.

### Subclassing Source Revisions

As with many HealthKit classes, don’t subclass the [`HKSourceRevision`](/documentation/HealthKit/HKSourceRevision) class.

## Topics

### Creating Source Revision Objects

[`-  initWithSource:version:`](/documentation/HealthKit/HKSourceRevision/init(source:version:))

Initializes a new source revision object with the provided source and version information.

[`-  initWithSource:version:productType:operatingSystemVersion:`](/documentation/HealthKit/HKSourceRevision/init(source:version:productType:operatingSystemVersion:))

Initializes a new source revision object with the provided source, version, product type, and operating system.

### Accessing Source and Version Information

[`source`](/documentation/HealthKit/HKSourceRevision/source)

The source for a sample.

[`version`](/documentation/HealthKit/HKSourceRevision/version)

A string that identifies a particular version of the source.

[`operatingSystemVersion`](/documentation/HealthKit/HKSourceRevision/operatingSystemVersion)

A string that identifies the operating system used to save a sample.

[`productType`](/documentation/HealthKit/HKSourceRevision/productType)

A string that identifies the device used to save a sample.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Sendable`](/documentation/Swift/Sendable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)