BRSurveyQuestion

Objective-C

@interface BRSurveyQuestion : NSObject

Swift

class BRSurveyQuestion : NSObject

Represents a survey question, which is either multiple choice or open-ended

Properties

  • Survey question text

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSString *_Nonnull text;

    Swift

    var text: String { get }
  • Survey question type

    Declaration

    Objective-C

    @property (nonatomic, readonly) BRSurveyQuestionType type;

    Swift

    var type: BRSurveyQuestionType { get }
  • Array of multiple choice answers to this question, if the type is BRSurveyQuestionTypeMultipleChoice

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray<BRSurveyAnswer *> *_Nonnull answers;

    Swift

    var answers: [BRSurveyAnswer] { get }
  • Indicates whether multiple answers can be selected, if the type is BRSurveyQuestionTypeMultipleChoice

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL multipleAnswers;

    Swift

    var multipleAnswers: Bool { get }
  • The user’s response to this survey question, if the survey was completed

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) BRSurveyResponse *_Nonnull userResponse;

    Swift

    var userResponse: BRSurveyResponse { get }

Methods

  • When displaying the survey with a custom UI, call this method to indicate the user’s answer to this question

    Declaration

    Objective-C

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

    Swift

    func addUserResponse(_ response: BRSurveyResponse)

    Parameters

    response

    The user’s response to this question

  • When displaying the survey with a custom UI, after adding the user’s response to the current question, call this method to get the next question index to display (since the flow may be dynamic based on the user’s responses). A return value of -1 indicates there are no further questions.

    Declaration

    Objective-C

    - (NSInteger)getNextQuestionIndex;

    Swift

    func getNextQuestionIndex() -> Int