EnterpriseDS Documentation

Structure DSAdHoc​Validation​Rule

public struct DSAdHocValidationRule: DSValidationRule  

A validation rule that allows for an error message to be expressly set. When the message is non-empty, the validation fails. This validation rule is useful for showing backend errors.

DSAdHocValidationRule DSAdHocValidationRule DSValidationRule DSValidationRule DSAdHocValidationRule->DSValidationRule

Conforms To

DSValidationRule

A validation framework for defining how text entered into a DSTextField can be validated and an appropriate error message provided if that validation fails. Multiple DSValidationRule objects can stack to perform multiple validations including the special DSRequiredTextValidationRule which is the only built-in rule validates empty fields.

Initializers

init(message:​)

public init(message: String? = nil)  

Initializes the validation rule.

Parameters

message String?

Error message to display and forces validation to fail

Properties

error​Message

public var errorMessage: String = ""

The error message to force to be displayed.

Methods

is​Valid(_:​)

public func isValid(_ text: String) -> Bool  

Fails validation if an error message has been set.