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