ORKHealthKitQuantityTypeAnswerFormat Class Reference

Inherits from ORKAnswerFormat : NSObject
Declared in ORKHealthAnswerFormat.h

The ORKHealthKitQuantityTypeAnswerFormat class represents an answer format that lets participants enter values that correspond to a HealthKit quantity type, such as systolic blood pressure.

The actual UI used for collecting data with this answer format depends on the HealthKit type being collected. The default value in the UI is the most recent value received from HealthKit, if such a value exists. When a step or item is presented using this answer format, authorization is requested.

You can use the HealthKit quantity type answer format to let users autofill values such as their weight with the most recent data from HealthKit.

+ answerFormatWithQuantityType:unit:style:

Returns a new HealthKit quantity answer format with the specified quantity type.

+ (instancetype)answerFormatWithQuantityType:(HKQuantityType *)quantityType unit:(nullable HKUnit *)unit style:(ORKNumericAnswerStyle)style

Parameters

quantityType

The HealthKit quantity type to collect.

unit

The unit used to describe the quantity. If the value of this parameter is nil, the default HealthKit unit is used, when available.

style

The numeric answer style to use when collecting this value.

Return Value

A HealthKit quantity answer format instance.

Declared In

ORKHealthAnswerFormat.h

– initWithQuantityType:unit:style:

Returns an initialized HealthKit quantity answer format using the specified quantity type, unit, and numeric answer style.

- (instancetype)initWithQuantityType:(HKQuantityType *)quantityType unit:(nullable HKUnit *)unit style:(ORKNumericAnswerStyle)style

Parameters

quantityType

The HealthKit quantity type to collect.

unit

The unit used to describe the quantity. If the value of this parameter is nil, the default HealthKit unit is used, when available.

style

The numeric answer style to use when collecting this value.

Return Value

An initialized HealthKit quantity answer format.

Discussion

This method is the designated initializer.

Declared In

ORKHealthAnswerFormat.h

  quantityType

The HealthKit quantity type to collect. (read-only)

@property (nonatomic, copy, readonly) HKQuantityType *quantityType

Declared In

ORKHealthAnswerFormat.h

  unit

The HealthKit unit in which to collect the answer. (read-only)

@property (nonatomic, strong, readonly, nullable) HKUnit *unit

Discussion

The unit is displayed when the user is entering data, and is also included in the question result generated by form items or question steps that use this answer format.

Declared In

ORKHealthAnswerFormat.h

  numericAnswerStyle

The numeric answer style. (read-only)

@property (nonatomic, readonly) ORKNumericAnswerStyle numericAnswerStyle

Declared In

ORKHealthAnswerFormat.h