LengthRule
public class LengthRule : ValidationRule<String>
LengthRule is a subclass of ValidationRule that defines how length is validated with min & max limits.
-
Initializes a
LengthRuleobject to verify that length of value is in the range of min & max.Declaration
Swift
public init(min: Int, max: Int, message: String? = nil)Parameters
minMinimum required length of value.
maxMaximum required length of value.
messageString of error message.
Return Value
An initialized object.
-
Method used to validate the provided value.
Declaration
Swift
public override func validate(_ value: String?) -> String?Parameters
valueString value to be checked for validation.
Return Value
Error Message String. nil if validation is successful;
Stringif validation fails.
View on GitHub
LengthRule Class Reference