revised for validatiod
This commit is contained in:
parent
515384fdd6
commit
0f9e6d4dae
@ -317,6 +317,13 @@ import UIKit
|
||||
})
|
||||
}
|
||||
|
||||
model.updateUIDynamicError = { [weak self] in
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||
guard let self = self else { return }
|
||||
self.updateValidation(model.isValid ?? false)
|
||||
})
|
||||
}
|
||||
|
||||
title = model.title
|
||||
feedback = model.feedback
|
||||
isEnabled = model.enabled
|
||||
|
||||
@ -22,7 +22,12 @@ import Foundation
|
||||
public var accessibilityIdentifier: String?
|
||||
public var title: String?
|
||||
public var feedback: String?
|
||||
public var dynamicErrorMessage: String?
|
||||
public var dynamicErrorMessage: String? {
|
||||
didSet {
|
||||
isValid = false
|
||||
updateUIDynamicError?()
|
||||
}
|
||||
}
|
||||
public var errorMessage: String?
|
||||
public var errorTextColor: Color?
|
||||
public var enabled: Bool = true
|
||||
@ -43,6 +48,8 @@ import Foundation
|
||||
/// Temporary binding mechanism for the view to update on enable changes.
|
||||
public var updateUI: ActionBlock?
|
||||
|
||||
public var updateUIDynamicError: ActionBlock?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -449,18 +449,11 @@ import UIKit
|
||||
let entryFieldModel = formValidator?.fields[fieldName] as? EntryFieldModel
|
||||
else { continue }
|
||||
|
||||
entryFieldModel.dynamicErrorMessage = userError
|
||||
entryFieldModel.isValid = false
|
||||
|
||||
if fieldError["clearText"] as? Bool ?? true {
|
||||
entryFieldModel.text = ""
|
||||
}
|
||||
|
||||
DispatchQueue.main.async { [self] in
|
||||
if let view = UIView.findByAccessibility(identifier: fieldName), let moleculeView = view as? MoleculeViewProtocol {
|
||||
moleculeView.set(with: entryFieldModel, delegateObjectIVar, nil)
|
||||
}
|
||||
}
|
||||
entryFieldModel.dynamicErrorMessage = userError
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user