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.

Beta

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.

Beta

Relationships

Inherits From

Conforms To

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software