This commit is contained in:
Suresh, Kamlesh 2019-12-12 11:47:33 -05:00
parent 7c7232fe6a
commit 9a4a5139ed
3 changed files with 19 additions and 19 deletions

View File

@ -51,16 +51,16 @@ import UIKit
super.updateView(size)
dropDown?.updateView(size)
}
// // MARK: - MoleculeDelegateProtocol
// public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
// bottomSeparatorView?.style = .none
// self.delegateObject = delegateObject
// super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
// dropDown?.mfTextFieldDelegate = delegateObject?.uiTextFieldDelegate as? MFTextFieldDelegate
// dropDown?.uiTextFieldDelegate = delegateObject?.uiTextFieldDelegate
// dropDown?.setWithJSON(json?.optionalDictionaryForKey("dropDown"), delegateObject: delegateObject, additionalData: additionalData)
// }
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
bottomSeparatorView?.style = .none
self.delegateObject = delegateObject
super.setWithModel(model, delegateObject, additionalData)
dropDown?.mfTextFieldDelegate = delegateObject?.uiTextFieldDelegate as? MFTextFieldDelegate
dropDown?.uiTextFieldDelegate = delegateObject?.uiTextFieldDelegate
dropDown?.setWithJSON(json?.optionalDictionaryForKey("dropDown"), delegateObject: delegateObject, additionalData: additionalData)
}
public override func reset() {
super.reset()

View File

@ -176,7 +176,7 @@ import UIKit
// override the separator
if let separator = model.separator {
addSeparatorsIfNeeded()
(bottomSeparatorView as? ModelMoleculeViewProtocol)?.setWithModel(separator, nil, nil)
bottomSeparatorView?.setWithModel(separator, nil, nil)
}
guard let moleculeModel = model.molecule else { return }

View File

@ -160,14 +160,14 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
public func removeMolecules(_ molecules: [MoleculeProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
var indexPaths: [IndexPath] = []
//TODO: cehck for molecule protocola eqality
// for molecule in molecules {
// if let removeIndex = moleculesInfo?.firstIndex(where: { (moleculeInfo) -> Bool in
// return molecule == moleculeInfo.molecule
// }) {
// moleculesInfo?.remove(at: removeIndex)
// indexPaths.append(IndexPath(row: removeIndex + indexPaths.count, section: 0))
// }
// }
for molecule in molecules {
if let removeIndex = moleculesInfo?.firstIndex(where: { (moleculeInfo) -> Bool in
return molecule.toJSONString() == moleculeInfo.molecule.toJSONString()
}) {
moleculesInfo?.remove(at: removeIndex)
indexPaths.append(IndexPath(row: removeIndex + indexPaths.count, section: 0))
}
}
self.tableView?.deleteRows(at: indexPaths, with: animation)
self.updateViewConstraints()
self.view.layoutIfNeeded()