implemented new protocol
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
716550bf23
commit
c925323347
@ -6,7 +6,7 @@
|
|||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
// Form fields are items can be interacted with. They have value, and may need to be validated.
|
// Form fields are items can be interacted with. They have value, and may need to be validated.
|
||||||
|
import VDS
|
||||||
|
|
||||||
public protocol FormFieldProtocol: FormItemProtocol {
|
public protocol FormFieldProtocol: FormItemProtocol {
|
||||||
|
|
||||||
@ -36,6 +36,21 @@ public extension FormFieldProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public protocol FormFieldInternalValidatableProtocol: FormFieldProtocol {
|
||||||
|
associatedtype ValueType
|
||||||
|
var rules: [AnyRule<ValueType>]? { get set }
|
||||||
|
var internalRules: [RuleAnyModelProtocol]? { get }
|
||||||
|
}
|
||||||
|
|
||||||
|
extension FormFieldInternalValidatableProtocol {
|
||||||
|
public var internalRules: [RuleAnyModelProtocol]? {
|
||||||
|
guard let fieldKey else { return nil }
|
||||||
|
return rules?.compactMap{ rule in
|
||||||
|
return RuleVDSModel(field: fieldKey, rule: rule)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class FormFieldValidity{
|
public class FormFieldValidity{
|
||||||
public var fieldKey: String
|
public var fieldKey: String
|
||||||
public var valid: Bool = true
|
public var valid: Bool = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user