MinLengthRule

public class MinLengthRule: Rule

MinLengthRule is a subclass of Rule that defines how minimum character length is validated.

  • Declaration

    Swift

    public init(){}

    Return Value

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

  • Initializes a MaxLengthRule object that is to validate the length of the text of a text field.

    Declaration

    Swift

    public init(length: Int, message : String = "Must be at least %ld characters long")

    Parameters

    length

    Minimum character length.

    message

    String of error message.

    Return Value

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

  • Validates a text field. - parameter value: String to checked for validation. - returns: A boolean value. True if validation is successful; False if validation fails.

    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 error message when text field has failed validation.

    Declaration

    Swift

    public func errorMessage() -> String

    Return Value

    String of error message.