updated credit card rule
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
2e46759857
commit
ba0989bb2b
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user