ArrayLengthRule
public class ArrayLengthRule<V> : ValidationRule<Array<V>>
ArrayLengthRule
is a subclass of ValidationRule
that defines how length is validated with min & max limits.
-
Initializes a
ArrayLengthRule
object 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
min
Minimum required length of value.
max
Maximum required length of value.
message
String of error message.
Return Value
An initialized object.
-
Method used to validate the provided value.
Declaration
Swift
public override func validate(_ value: Array<V>?) -> String?
Parameters
value
Any Array value to be checked for validation.
Return Value
Error Message. nil if validation is successful;
String
if validation fails.