LogHealthSample

public struct LogHealthSample<MeasurementType> : Shortcut where MeasurementType : HealthMeasurementType

Adds a data point into the Health app. You can log anything that the Health app supports, including your weight, steps taken, running distance, caloric intake and more.

Result: Health sample

  • The contents of the shortcut.

    Declaration

    Swift

    public var body: some Shortcut { get }
  • Initializes the shortcut.

    Declaration

    Swift

    public init(type: HealthSampleType<MeasurementType>, value: HealthSampleMeasurement<MeasurementType>, date: Text = "")

    Parameters

    type

    The type of health sample to log.

    value

    The value of the health sample.

    date

    The date and time of the data point. The current date will be used if you don’t provide a date.

  • Initializes the shortcut.

    Declaration

    Swift

    public init(type: HealthSampleType<MeasurementType>, magnitude: Text, unit: HealthSampleUnit<MeasurementType>, date: Text = "")

    Parameters

    type

    The type of health sample to log.

    magnitude

    The size of the health sample.

    unit

    The unit of the health sample.

    date

    The date and time of the data point. The current date will be used if you don’t provide a date.

  • Initializes the shortcut.

    Declaration

    Swift

    public init(type: HealthSampleType<MeasurementType>, magnitude: Variable, unit: HealthSampleUnit<MeasurementType>, date: Text = "")

    Parameters

    type

    The type of health sample to log.

    magnitude

    The size of the health sample, as a Variable.

    unit

    The unit of the health sample.

    date

    The date and time of the data point. The current date will be used if you don’t provide a date.