Contents

insert(_:for:)

Adds a new quantity to the series with the provided date interval.

Declaration

func insert(_ quantity: HKQuantity, for dateInterval: DateInterval) throws

Parameters

  • quantity:

    The quantity to insert.

  • dateInterval:

    The date interval associated with the quantity. If the interval’s Start parameter is the same as the start date for 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

Use this method to add a quantity to the series. The quantity must have a unit that is compatible with the series builder’s quantity type (see is(compatibleWith:)).

See Also

Adding Values