---
title: "init(unit:doubleValue:)"
framework: healthkit
role: symbol
role_heading: Initializer
path: "healthkit/hkquantity/init(unit:doublevalue:)"
---

# init(unit:doubleValue:)

Instantiates and returns a new quantity object.

## Declaration

```swift
convenience init(unit: HKUnit, doubleValue value: Double)
```

## Parameters

- `unit`: The units for the given value. This defines the set of compatible units. For example, if you create a quantity with a meter unit, it is compatible with any other length units.
- `value`: The value of this quantity, measured using the unit parameter.

## Return Value

Return Value A newly instantiated quantity instance.

## Discussion

Discussion HealthKit uses quantity objects to store data for quantity samples. For more information on using quantity objects, see HKQuantitySample.
