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
MonthRuleobject 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
messageString of error message.
Return Value
An initialized
MonthRuleobject. -
Validates a field.
Declaration
Swift
public override func validate(_ value: String?) -> String?Parameters
valueString to check for validation.
Return Value
Error Message. nil on successful validation, otherwise
Stringon failed Validation.
View on GitHub
MonthRule Class Reference