Rule

public protocol Rule

The Rule protocol declares the required methods for all objects that subscribe to it.

  • Validates text of a text field.

    Declaration

    Swift

    func validate(value: String) -> Bool

    Parameters

    value

    String of text to be validated.

    Return Value

    Boolean value. True if validation is successful; False if validation fails.

  • Displays error message of a text field that has failed validation.

    Declaration

    Swift

    func errorMessage() -> String

    Return Value

    String of error message.