updated credit card rule

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-06-06 15:54:56 -05:00
parent 2e46759857
commit ba0989bb2b

View File

@ -9,11 +9,11 @@ import Foundation
import UIKit
extension InputField {
class CreditCardNumberRule: Rule, Withable {
var cardType: CreditCardType?
var errorMessage: String = "You have exceeded the character limit."
public class CreditCardNumberRule: Rule, Withable {
public var cardType: CreditCardType?
public var errorMessage: String = "You have exceeded the character limit."
func isValid(value: String?) -> Bool {
public func isValid(value: String?) -> Bool {
guard let count = value?.count, let min = cardType?.minLength, let max = cardType?.maxLength else { return true }
if min == max {
return count == max