Initializer

init(source:version:)

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

Declaration

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.

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

Creating Source Revision Objects

init(source: HKSource, version: String?, productType: String?, operatingSystemVersion: OperatingSystemVersion)

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