HealthSampleType
public struct HealthSampleType<MeasurementType> : RawRepresentable, Encodable where MeasurementType : HealthMeasurementType
The type of a Health sample, such as “Water” or “Vitamin C”.
-
The corresponding value of the raw type.
Declaration
Swift
public let rawValue: String
-
Creates a new instance with the specified raw value.
Declaration
Swift
public init(rawValue: String)
Parameters
rawValue
The raw value to use for the new instance.
-
Creates a new instance with the specified raw value.
Declaration
Swift
public init(_ rawValue: String)
Parameters
rawValue
The raw value to use for the new instance.
-
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) throws
Parameters
encoder
The encoder to write data to.
-
The “Steps” sample type in the Health app.
Declaration
Swift
public static var steps: HealthSampleType { get }
-
The “Water” sample type in the Health app.
Declaration
Swift
public static var water: HealthSampleType { get }