MaxLengthRule
public class MaxLengthRule: Rule
MaxLengthRule is a subclass of Rule that defines how maximum character length is validated.
-
Declaration
Swift
public init(){}Return Value
An initialized
MaxLengthRuleobject, or nil if an object could not be created for some reason that would not result in an exception. -
Initializes a
MaxLengthRuleobject that is to validate the length of the text of a text field.Declaration
Swift
public init(length: Int, message : String = "Must be at most %ld characters long")Parameters
lengthMaximum character length.
messageString 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 text field.
Declaration
Swift
public func validate(value: String) -> BoolParameters
valueString to checked for validation.
Return Value
A boolean value. True if validation is successful; False if validation fails.
-
Displays an error message if a text field fails validation.
Declaration
Swift
public func errorMessage() -> StringReturn Value
String of error message.
MaxLengthRule Class Reference