ORKPageStep Class Reference

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

Overview

The ORKPageStep class is a concrete subclass of ORKStep, used for presenting a subgrouping of ORKStepViewController views using a UIPageViewController.

To use ORKPageStep, 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.

The base class implementation will instatiate a read-only ORKPageStepViewController to display a series of substeps. For each substep, the ORKStepViewController will be instantiated and added as a child of the UIPageViewController contained by the parent ORKPageStepViewController..

Customization can be handled by overriding the base class implementations in either ORKPageStep or ORKPageStepViewController.

– initWithIdentifier:

- (instancetype)initWithIdentifier:(NSString *)identifier

Declared In

ORKStep.h

– initWithIdentifier:steps:

Returns an initialized page step using the specified identifier and array of steps.

- (instancetype)initWithIdentifier:(NSString *)identifier steps:(NSArray<ORKStep*> *)steps

Parameters

identifier

The unique identifier for the step.

steps

An array of ORKStep objects in the order in which they should be presented.

Return Value

An initialized page step.

Declared In

ORKPageStep.h

– steps

The array of steps in the page step. (read-only)

- (NSArray<ORKStep*> *)steps

Discussion

Each element in the array must be a subclass of ORKStep. The associated page step view controller presents the steps in array order.

Declared In

ORKPageStep.h

+ stepViewControllerClass

+ (Class)stepViewControllerClass

Declared In

ORKStep.h

– requestedPermissions

The set of access permissions required for the step. (read-only)

- (ORKPermissionMask)requestedPermissions

Discussion

The permission mask is used by the task view controller to determine the types of access to request from users when they complete the initial instruction steps in a task. If your step requires access to APIs that limit access, include the permissions you require in this mask.

By default, the property scans the recorders and collates the permissions required by the recorders. Subclasses may override this implementation.

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

– 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

– stepAfterStepWithIdentifier:withResult:

Returns the step after the specified step, if there is one.

- (ORKStep *)stepAfterStepWithIdentifier:(NSString *)identifier withResult:(ORKTaskResult *)result

Parameters

identifier

The reference step identifier. Pass nil to specify the first step.

result

A snapshot of the current set of results.

Return Value

The step that comes after the specified step, or nil if there isn’t one.

Discussion

The page view controller calls this method to determine the step to display after the specified step. The page view controller can also call this method every time the result updates, to determine if the new result changes which steps are available.

Declared In

ORKPageStep.h

– stepBeforeStepWithIdentifier:withResult:

Returns the step that precedes the specified step, if there is one.

- (ORKStep *)stepBeforeStepWithIdentifier:(NSString *)identifier withResult:(ORKTaskResult *)result

Parameters

identifier

The reference step identifier.

result

A snapshot of the current set of results.

Return Value

The step that precedes the reference step, or nil if there isn’t one.

Discussion

The page view controller calls this method to determine the step to display before the specified step. The page view controller can also call this method every time the result changes, to determine if the new result changes which steps are available.

Declared In

ORKPageStep.h

– stepWithIdentifier:

Returns the step that matches the specified identifier.

- (ORKStep *)stepWithIdentifier:(NSString *)identifier

Parameters

identifier

The identifier of the step to restore.

Return Value

The step that matches the specified identifier, or nil if there isn’t one.

Declared In

ORKPageStep.h

– initWithCoder:

Returns a page step initialized from data in the given unarchiver.

- (instancetype)initWithCoder:(NSCoder *)aDecoder

Parameters

aDecoder

The coder from which to initialize the ordered task.

Return Value

An initialized page step.

Discussion

A page step can be serialized and deserialized with NSKeyedArchiver. Note that this serialization includes strings that might need to be localized.

Declared In

ORKPageStep.h