didn't carry over

This commit is contained in:
Kevin G Christiano 2020-03-25 17:14:16 -04:00
parent 2333a38035
commit 7b857414af

View File

@ -29,16 +29,16 @@ import UIKit
guard newValue != oldValue,
let self = self,
let index = self.dropDown.pickerData.firstIndex(of: newValue),
let model = self.listItemModel as? DropDownListItemModel
let dropListItemJSON = (self.listItemModel as? DropDownListItemModel).toJSON(),
let json2d = dropListItemJSON.optionalArrayForKey("molecules") as? [[[AnyHashable: Any]]],
!json2d.isEmpty && !(json2d.first?.isEmpty ?? false)
else { return }
if self.previousIndex != NSNotFound {
self.delegateObject?.moleculeDelegate?.removeMolecules(model.molecules[self.previousIndex], animation: .fade)
self.delegateObject?.moleculeDelegate?.removeMolecules(json2d[self.previousIndex], sender: self, animation: .fade)
}
if let indexPath = self.delegateObject?.moleculeDelegate?.getIndexPath(for: model) {
self.delegateObject?.moleculeDelegate?.addMolecules(model.molecules[index], indexPath: indexPath, animation: .fade)
}
self.delegateObject?.moleculeDelegate?.addMolecules(json2d[index], sender: self, animation: .fade)
self.previousIndex = index
}
}