ORKFormStep Class Reference

Inherits from ORKStep : NSObject
Declared in ORKFormStep.h
ORKFormStep.m

Overview

The ORKFormStep class is a concrete subclass of ORKStep, used for presenting multiple questions on a single scrollable page.

To use ORKFormStep, instantiate the object, fill in its properties, and include it in a task. Next, create a task view controller for the task and present it. When the task completes, the user’s answers are encoded in the result hierarchy in the task view controller.

Each question in the form is represented by an ORKFormItem object. The form items have an optional property that defaults to YES. All required questions need to be answered for the Continue button to be enabled. If all the form items are optional, at least one question needs to be answered for the Continue button to be enabled. You can allow the user to completely skip a form step using the Skip button, even if it has required form items, by setting the form step optional property to yes.

The form can be broken into sections by using an ORKFormItem object that includes only a section title.

The result of a form step is an ORKStepResult object that includes a child ORKQuestionResult object for each form item.

Other Methods

+ stepViewControllerClass

+ (Class)stepViewControllerClass

Declared In

ORKStep.h

– initWithIdentifier:title:text:

Returns an initialized form step using the specified identifier, title, and text.

- (instancetype)initWithIdentifier:(NSString *)identifier title:(NSString *)title text:(NSString *)text

Parameters

identifier

The string that identifies the step (see ORKStep).

title

The title of the form (see ORKStep).

text

The text shown immediately below the title (see ORKStep).

Return Value

As initialized form step object.

Declared In

ORKFormStep.h

– initWithIdentifier:

- (instancetype)initWithIdentifier:(NSString *)identifier

Declared In

ORKStep.h

– validateParameters

Checks the parameters of the step and throws exceptions on invalid parameters.

- (void)validateParameters

Discussion

This method is called when there is a need to validate the step’s parameters, which is typically the case when adding a step to an ORKStepViewController object, and when presenting the step view controller.

Subclasses should override this method to provide validation of their additional properties, and must call super.

Declared In

ORKStep.h

– initWithCoder:

- (instancetype)initWithCoder:(NSCoder *)aDecoder

Declared In

ORKStep.h

– requestedHealthKitTypesForReading

The set of HealthKit types the step requests for reading. (read-only)

- (NSSet<HKObjectType*> *)requestedHealthKitTypesForReading

Discussion

The task view controller uses this set of types when constructing a list of all the HealthKit types required by all the steps in a task, so that it can present the HealthKit access dialog just once during that task.

By default, the property scans the recorders and collates the HealthKit types the recorders require. Subclasses may override this implementation.

Declared In

ORKStep.h

Other Methods

  footnote

Additional text to display for the step in a localized string at the bottom of the view.

@property (nonatomic, copy, nullable) NSString *footnote

Discussion

The footnote is displayed in a smaller font below the continue button. It is intended to be used in order to include disclaimer, copyright, etc. that is important to display in the step but should not distract from the main purpose of the step.

Declared In

ORKFormStep.h

  formItems

The array of items in the form.

@property (nonatomic, copy, nullable) NSArray<ORKFormItem*> *formItems

Discussion

A form step that contains no items is considered invalid and an exception will be thrown when it is presented.

Declared In

ORKFormStep.h

  useCardView

The property to present the form with all the items in a card view. Default to YES;

@property (nonatomic) BOOL useCardView

Declared In

ORKFormStep.h