RangeRule
public class RangeRule<V> : ValidationRule<V> where V : Comparable, V : CustomStringConvertible
RangeRule is a subclass of ValidationRule that defines how value is validated with min & max limits.
-
Initializes a
RangeRuleobject to verify that quantity of value is in the range of min & max.Declaration
Swift
public init(min: V, max: V, message: String? = nil)Parameters
minMinimum required quantity of value.
maxMaximum required quantity 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: V?) -> String?Parameters
valueAny value to be checked for validation.
Return Value
Error Message. nil if validation is successful;
Stringif validation fails.
View on GitHub
RangeRule Class Reference