Contents

insert(_:at:)

Adds a new quantity to the series at the provided date and time.

Declaration

func insert(_ quantity: HKQuantity, at date: Date) throws

Parameters

  • quantity:

    The quantity to insert.

  • date:

    The start date associated with the quantity. If this is the same start date as a previously provided quantity, this quantity replaces the previous one. This method fails with an Errorinvalidargument error if the date parameter is earlier than the series builder’s Startdate property.

Discussion

This method calls insert(_:for:), passing a date interval with the provided start date, and a duration of 0.

See Also

Adding Values