diff --git a/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift b/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift index 7bd05047..8b578fb3 100644 --- a/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift @@ -6,7 +6,7 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // // Form fields are items can be interacted with. They have value, and may need to be validated. - +import VDS public protocol FormFieldProtocol: FormItemProtocol { @@ -36,6 +36,21 @@ public extension FormFieldProtocol { } } +public protocol FormFieldInternalValidatableProtocol: FormFieldProtocol { + associatedtype ValueType + var rules: [AnyRule]? { 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 var fieldKey: String public var valid: Bool = true