Inherits from NSObject
Declared in SurveyValidator.h

Overview

SurveyValidator is a class designed to handle field validation.

Tasks

Uses defined validation to validate given values.

Class Methods

instance

Returns an instance of the SurveyValidator

+ (instancetype)instance

Return Value

an instance of the SurveyValidator

Discussion

Returns an instance of the SurveyValidator

Declared In

SurveyValidator.h

registerValidation:withBlock:

Shortcut method to register validators

+ (void)registerValidation:(NSString *)validationName withBlock:(SurveyValidationBlock)block

Parameters

validationName

Name for the validation block

block

Callback used to validate given value.

Discussion

Shortcut method to register validators

Declared In

SurveyValidator.h

validateString:withValidator:

Shortcut method to validate provided string.

+ (BOOL)validateString:(NSString *)value withValidator:(NSString *)validatorName

Parameters

value

String to validate

validatorName

Validator to use to validate value.

Return Value

a YES/NO if string value validates against validator with provided name.

Discussion

Shortcut method to validate provided string.

Declared In

SurveyValidator.h

Instance Methods

registerValidation:withBlock:

Registers validation block methods with a given name.

- (void)registerValidation:(NSString *)validationName withBlock:(SurveyValidationBlock)block

Parameters

validationName

Name for the validation block

block

Callback used to validate given value.

Discussion

Registers validation block methods with a given name.

@discussion The block passes the value of the field to the provided block which will return a true or false response, validationName can be anything, see SurveyDefines.h for predefined validators.

Declared In

SurveyValidator.h

resetValidatorsToDefault

Resets all registered validators back to Survey’s default validators.

- (void)resetValidatorsToDefault

Discussion

Resets all registered validators back to Survey’s default validators.

Declared In

SurveyValidator.h

validateString:withValidator:

Returns a YES/NO if string value validates against validator with provided name.

- (BOOL)validateString:(NSString *)value withValidator:(NSString *)validatorName

Parameters

value

String to validate

validatorName

Validator to use to validate value.

Return Value

a YES/NO if string value validates against validator with provided name.

Discussion

Returns a YES/NO if string value validates against validator with provided name.

Declared In

SurveyValidator.h