---
title: "init(source:version:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hksourcerevision/init(source:version:)"
---

# init(source:version:)

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

## Declaration

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

## Parameters

- `source`: The source for a sample.
- `version`: A string that uniquely identifies the source’s version.

## Return Value

Return Value A newly initialized source revision object.

## Discussion

Discussion Use this method to create source revisions for use in queries. For more information, see 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 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

### Related Documentation

- [HKSourceRevisionAnyVersion](healthkit/hksourcerevisionanyversion.md)

### Creating Source Revision Objects

- [init(source:version:productType:operatingSystemVersion:)](healthkit/hksourcerevision/init(source:version:producttype:operatingsystemversion:).md)
