RBManagedFormValidationRule Class Reference

Inherits from NSObject
Declared in RBManagedFormValidationRule.h

Overview

A validation rule for a managed form field.

  data

The validation rule context data.

@property (nonatomic, readonly, nullable) id data

Declared In

RBManagedFormValidationRule.h

  failureMessage

The failure message to be used when the field is invalid.

@property (nonatomic, readonly, nullable) NSString *failureMessage

Declared In

RBManagedFormValidationRule.h

+ ruleWithValidationBlock:failureMessage:

Creates a new validation rule that uses a custom block.

+ (nonnull instancetype)ruleWithValidationBlock:(nonnull BOOL ( ^ ) ( id __nullable value ))validationBlock failureMessage:(nonnull NSString *)failureMessage

Parameters

validationBlock

The custom block to call on the value to determine whether it’s valid.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ nonEmptyRuleWithFailureMessage:

Creates a new validation rule that the field cannot be empty.

+ (nonnull instancetype)nonEmptyRuleWithFailureMessage:(nonnull NSString *)failureMessage

Parameters

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithRegularExpression:failureMessage:

Creates a new validation rule that applies a regular expression to the field value.

+ (nonnull instancetype)ruleWithRegularExpression:(nonnull NSString *)regularExpression failureMessage:(nonnull NSString *)failureMessage

Parameters

regularExpression

The regular expression to match on the field value.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithNumericRangeFrom:to:failureMessage:

Creates a new validation rule that ensures a numeric field has a value in the given range.

+ (nonnull instancetype)ruleWithNumericRangeFrom:(double)minimumValue to:(double)maximumValue failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumValue

The minimum value.

maximumValue

The maximum value.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithNumericMinimumValue:failureMessage:

Creates a new validation rule that ensures a numeric field has a minimum value.

+ (nonnull instancetype)ruleWithNumericMinimumValue:(double)minimumValue failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumValue

The minimum value.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithNumericMaximumValue:failureMessage:

Creates a new validation rule that ensures a numeric field has a maximum value.

+ (nonnull instancetype)ruleWithNumericMaximumValue:(double)maximumValue failureMessage:(nonnull NSString *)failureMessage

Parameters

maximumValue

The maximum value.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithImageSizeRangeFrom:to:failureMessage:

Creates a new validation rule that enforces an image size range.

+ (nonnull instancetype)ruleWithImageSizeRangeFrom:(CGSize)minimumSize to:(CGSize)maximumSize failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumSize

The minimum image size.

maximumSize

The maximum image size.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithImageMinimumSize:failureMessage:

Creates a new validation rule that enforces a minimum image size.

+ (nonnull instancetype)ruleWithImageMinimumSize:(CGSize)minimumSize failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumSize

The minimum image size.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithImageMaximumSize:failureMessage:

Creates a new validation rule that enforces a maximum image size.

+ (nonnull instancetype)ruleWithImageMaximumSize:(CGSize)maximumSize failureMessage:(nonnull NSString *)failureMessage

Parameters

maximumSize

The maximum image size.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithImageAspectRatio:failureMessage:

Creates a new validation rule that enforces an image aspect ratio.

+ (nonnull instancetype)ruleWithImageAspectRatio:(double)aspectRatio failureMessage:(nonnull NSString *)failureMessage

Parameters

aspectRatio

The aspect ratio required of the image.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithStringLengthRangeFrom:to:failureMessage:

Creates a new validation rule that enforces a string length range.

+ (nonnull instancetype)ruleWithStringLengthRangeFrom:(NSUInteger)minimumLength to:(NSUInteger)maximumLength failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumLength

The minimum string length.

maximumLength

The maximum string length.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithStringLengthMinimumLength:failureMessage:

Creates a new validation rule that enforces a minimum string length

+ (nonnull instancetype)ruleWithStringLengthMinimumLength:(NSUInteger)minimumLength failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumLength

The minimum string length.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithStringLengthMaximumLength:failureMessage:

Creates a new validation rule that enforces a maximum string length

+ (nonnull instancetype)ruleWithStringLengthMaximumLength:(NSUInteger)maximumLength failureMessage:(nonnull NSString *)failureMessage

Parameters

maximumLength

The maximum string length.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithArrayCountRangeFrom:to:failureMessage:

Creates a new validation rule that enforces an array count range.

+ (nonnull instancetype)ruleWithArrayCountRangeFrom:(NSUInteger)minimumCount to:(NSUInteger)maximumCount failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumCount

The minimum number of elements.

maximumCount

The maximum number of elements.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithArrayCountMinimum:failureMessage:

Creates a new validation rule that enforces a minimum array count.

+ (nonnull instancetype)ruleWithArrayCountMinimum:(NSUInteger)minimumCount failureMessage:(nonnull NSString *)failureMessage

Parameters

minimumCount

The minimum number of elements.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

+ ruleWithArrayCountMaximum:failureMessage:

Creates a new validation rule that enforces a maximum array count.

+ (nonnull instancetype)ruleWithArrayCountMaximum:(NSUInteger)maximumCount failureMessage:(nonnull NSString *)failureMessage

Parameters

maximumCount

The maximum number of elements.

failureMessage

The failure message to use when the field is invalid.

Return Value

The new validation rule.

Declared In

RBManagedFormValidationRule.h

– valueIsValid:

Runs the validation checks on the given value.

- (BOOL)valueIsValid:(nullable id)value

Parameters

value

The value to validate.

Return Value

Whether or not the value was found to be valid.

Declared In

RBManagedFormValidationRule.h