ConfirmationRule

public class ConfirmationRule: Rule

ConfirmationRule is a subclass of Rule that defines how a field that has to be equal to another field is validated.

  • Initializes a ConfirmationRule object to validate the text of a field that should equal the text of another field.

    Declaration

    Swift

    public init(confirmField: ValidatableField, message : String = "This field does not match")

    Parameters

    confirmField

    field to which original field will be compared to.

    message

    String of error message.

    Return Value

    An initialized object, or nil if an object could not be created for some reason that would not result in an exception.

  • Used to validate a field.

    Declaration

    Swift

    public func validate(_ value: String) -> Bool

    Parameters

    value

    String to checked for validation.

    Return Value

    A boolean value. True if validation is successful; False if validation fails.

  • Displays an error message when text field fails validation.

    Declaration

    Swift

    public func errorMessage() -> String

    Return Value

    String of error message.