ORKAnswerFormat Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in ORKAnswerFormat.h

The ORKAnswerFormat class is the abstract base class for classes that describe the format in which a survey question or form item should be answered. The ResearchKit framework uses ORKQuestionStep and ORKFormItem to represent questions to ask the user. Each question must have an associated answer format.

To use an answer format, instantiate the appropriate answer format subclass and attach it to a question step or form item. Incorporate the resulting step into a task, and present the task with a task view controller.

An answer format is validated when its owning step is validated.

Some answer formats are constructed of other answer formats. When this is the case, the answer format can implement the internal method _impliedAnswerFormat to return the answer format that is implied. For example, a Boolean answer format is presented in the same way as a single-choice answer format with the choices Yes and No mapping to @(YES) and @(NO), respectively.



The type of question. (read-only)

@property (readonly) ORKQuestionType questionType


You can use this enumerated value in your Objective-C code to switch on a rough approximation of the type of question that is being asked.

Note that answer format subclasses override the getter to return the appropriate question type.

Declared In



– validateParameters

Validates the parameters of the answer format to ensure that they can be displayed.

- (void)validateParameters


Typically, this method is called by the validation methods of the owning objects, which are themselves called when a step view controller that contains this answer format is about to be displayed.

Declared In