HealthSampleMeasurement
public struct HealthSampleMeasurement<MeasurementType> where MeasurementType : HealthMeasurementType
extension HealthSampleMeasurement: Encodable
A value that can be logged to the Health app.
See
See Also:LogHealthSample
-
The unit of the Health sample.
Declaration
Swift
public var unit: HealthSampleUnit<MeasurementType> -
Initializes the value.
Declaration
Swift
public init(magnitude: Text, unit: HealthSampleUnit<MeasurementType>)Parameters
magnitudeThe size of the health sample.
unitThe unit of the health sample.
-
Initializes the value.
Declaration
Swift
public init(magnitude: Variable, unit: HealthSampleUnit<MeasurementType>)Parameters
magnitudeThe size of the health sample, as a
Variable.unitThe unit of the health sample.
-
Encodes this value into the given encoder.
Throws
This function throws an error if any values are invalid for the given encoder’s format.Declaration
Swift
public func encode(to encoder: Encoder) throwsParameters
encoderThe encoder to write data to.
View on GitHub
HealthSampleMeasurement Structure Reference