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
|
import UIKit
|
||||||
|
|
||||||
extension InputField {
|
extension InputField {
|
||||||
class CreditCardNumberRule: Rule, Withable {
|
public class CreditCardNumberRule: Rule, Withable {
|
||||||
var cardType: CreditCardType?
|
public var cardType: CreditCardType?
|
||||||
var errorMessage: String = "You have exceeded the character limit."
|
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 }
|
guard let count = value?.count, let min = cardType?.minLength, let max = cardType?.maxLength else { return true }
|
||||||
if min == max {
|
if min == max {
|
||||||
return count == max
|
return count == max
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user