Skip to main content

BRSurveyQuestion

Represents one question in a survey.

Declaration

@interface BRSurveyQuestion : NSObject
class BRSurveyQuestion : NSObject

Quick Reference

Properties

PropertyDescription
textThe question text.
typeThe question type (multiple-choice or open-ended).
answersAvailable answer options when type is BRSurveyQuestionTypeMultipleChoice.
multipleAnswersWhether the respondent can select more than one answer.
userResponseThe user's response after the survey is completed.

Methods

MethodDescription
-addUserResponse:Records the user's answer to this question.
-getNextQuestionIndexReturns the index of the next question to display based on the user's response.

Properties

text (read-only)

@property (nonatomic, strong, readonly, nonnull) NSString *text;
var text: String { get }

The question text.


type (read-only)

@property (nonatomic, readonly) BRSurveyQuestionType type;
var type: BRSurveyQuestionType { get }

The question type (multiple-choice or open-ended).


answers (read-only)

@property (nonatomic, strong, readonly, nonnull) NSArray<BRSurveyAnswer *> *answers;
var answers: [BRSurveyAnswer] { get }

Available answer options when type is BRSurveyQuestionTypeMultipleChoice.


multipleAnswers (read-only)

@property (nonatomic, readonly) BOOL multipleAnswers;
var multipleAnswers: Bool { get }

Whether the respondent can select more than one answer.


userResponse (read-only)

@property (nonatomic, strong, readonly, nonnull) BRSurveyResponse *userResponse;
var userResponse: BRSurveyResponse { get }

The user's response after the survey is completed.


Methods

-addUserResponse:

- (void)addUserResponse:(nonnull BRSurveyResponse *)response;
func addUserResponse(_ response: BRSurveyResponse)

When displaying the survey with a custom UI, call this method to record the user's answer to this question.

Parameters:

ParameterDescription
responseA BRSurveyResponse object containing the user's selected answers or free-text entry

-getNextQuestionIndex

- (NSInteger)getNextQuestionIndex;
func getNextQuestionIndex() -> Int

When displaying the survey with a custom UI, call this method after adding the user's response to the current question to get the index of the next question to display. The flow may be dynamic based on the user's responses.

Returns: The index of the next question, or -1 if there are no further questions.