MonthRule
public class MonthRule : ValidationRule<String>
MonthRule
is a subclass of ValidationRule
that defines how a credit/debit’s card expiry month field is validated
-
Initializes
MonthRule
object with error message. Used to validate a month represented as number.Declaration
Swift
public override init(message: String = "not a valid month. must be 01 to 12.")
Parameters
message
String of error message.
Return Value
An initialized
MonthRule
object. -
Validates a field.
Declaration
Swift
public override func validate(_ value: String?) -> String?
Parameters
value
String to check for validation.
Return Value
Error Message. nil on successful validation, otherwise
String
on failed Validation.