vds_ios/VDS/Components/TextFields/Rules/RequiredRule.swift
Matt Bruce c326213302 initial generic entryfield
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2024-07-30 12:24:14 -05:00

22 lines
416 B
Swift

//
// RequiredRule.swift
// VDS
//
// Created by Matt Bruce on 4/30/24.
//
import Foundation
class RequiredRule<ValueType>: Rule {
var maxLength: Int?
var errorMessage: String = "This field is required."
func isValid(value: ValueType?) -> Bool {
guard let value,
!"\(value)".isEmpty,
"\(value)".count > 0 else { return false }
return true
}
}