<!--
{
  "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/init(source:version:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKSourceRevision(im)initWithSource:version:"
  },
  "title" : "init(source:version:)"
}
-->

# init(source:version:)

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

```
init(source: HKSource, version: String?)
```

## Parameters

`source`

The source for a sample.

`version`

A string that uniquely identifies the source’s version.

## Return Value

A newly initialized source revision object.

## Discussion

Use this method to create source revisions for use in queries. For more information, see [`HKPredicateKeyPathSourceRevision`](/documentation/HealthKit/HKPredicateKeyPathSourceRevision).

On iOS 9.0 or later, the system automatically creates a source revision for any samples saved to the HealthKit store. For earlier versions of iOS, the system only saves [`HKSource`](/documentation/HealthKit/HKSource) information. However, when these samples are retrieved on iOS 9.0 or later, the system creates a new source revision object for the sample. HealthKit uses the previously stored source information with a `nil`-valued version string.

## See Also

[`HKSourceRevisionAnyVersion`](/documentation/HealthKit/HKSourceRevisionAnyVersion)

A constant that matches any version.



---

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)