Class

HKQuantitySeriesSampleBuilder

A builder object for incrementally building a sample that contains multiple quantities.

Declaration

class HKQuantitySeriesSampleBuilder : NSObject

Topics

Creating a Quantity Series Builder

var quantityType: HKQuantityType

The quantity type for the series.

var startDate: Date

The starting date and time for the sample.

var device: HKDevice?

The device providing the data.

Adding Values

func insert(HKQuantity, at: Date)

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

func insert(HKQuantity, for: DateInterval)

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

Ending the Collection

func discard()

Discards all previously collected data and invalidates the builder.

func finishSeries(metadata: [String : Any]?, completion: ([HKQuantitySample]?, Error?) -> Void)

Finalizes the series and returns the resulting quantity samples.

func finishSeries(metadata: [String : Any]?, endDate: Date?, completion: ([HKQuantitySample]?, Error?) -> Void)

Finalizes the series with the provided end date, and returns the resulting quantity samples.

Relationships

Inherits From

Conforms To