model reuse again

This commit is contained in:
Kevin G Christiano 2020-01-24 10:41:38 -05:00
parent f43e018e21
commit af7e813e18
2 changed files with 13 additions and 12 deletions

View File

@ -277,19 +277,12 @@ import UIKit
guard let model = model as? TextEntryFieldModel else { return } guard let model = model as? TextEntryFieldModel else { return }
FormValidator.setupValidation(molecule: self, delegate: delegateObject?.formValidationProtocol) FormValidator.setupValidation(molecule: self, delegate: delegateObject?.formValidationProtocol)
if let enabledTextColor = model.enabledTextColor { textColor.enabled = model.enabledTextColor?.uiColor
textColor.enabled = enabledTextColor.uiColor textColor.disabled = model.disabledTextColor?.uiColor
}
if let disabledTextColor = model.disabledTextColor {
textColor.disabled = disabledTextColor.uiColor
}
text = model.text text = model.text
placeholder = model.placeholder placeholder = model.placeholder
switch model.type { switch model.type {
case "password": case "password":
textField.isSecureTextEntry = true textField.isSecureTextEntry = true

View File

@ -118,7 +118,7 @@ import UIKit
//-------------------------------------------------- //--------------------------------------------------
/// Holds reference to delegateObject to inform molecular tableView of an update. /// Holds reference to delegateObject to inform molecular tableView of an update.
weak var delegateObject: MVMCoreUIDelegateObject? var delegateObject: MVMCoreUIDelegateObject?
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Lifecycle // MARK: - Lifecycle
@ -271,9 +271,17 @@ import UIKit
layoutIfNeeded() layoutIfNeeded()
} }
} }
//--------------------------------------------------
// MARK: - MVMCoreUIMoleculeViewProtocol
//--------------------------------------------------
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.setWithModel(model, delegateObject, additionalData)
self.delegateObject = delegateObject
}
} }
// MARK:- MVMCoreUIMoleculeViewProtocol
extension EntryFieldContainer { extension EntryFieldContainer {
override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {