temp fix for arch issue

This commit is contained in:
Kevin G Christiano 2020-01-23 21:04:48 -05:00
parent 83d5721e68
commit c5e80d602e
2 changed files with 5 additions and 4 deletions

View File

@ -18,6 +18,7 @@ import MVMCore
public var style: String? = "standard"
private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor
case action
case hideArrow
@ -62,6 +63,7 @@ import MVMCore
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeModelIfPresent(action, forKey: .action)
try container.encodeIfPresent(hideArrow, forKey: .hideArrow)

View File

@ -153,8 +153,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
molecules.forEach { molecule in
let data = try? JSONSerialization.data(withJSONObject: molecule)
let decoder = JSONDecoder()
let listItemModel = try? decoder.decode(ListItemModel.self, from: data!)
let listItemModel = try? JSONDecoder().decode(ListItemModel.self, from: data!)
tmpMolecules.append(listItemModel!)
}
@ -162,8 +161,8 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
DispatchQueue.main.async {
guard let indexPath = self.tableView?.indexPath(for: sender) else { return }
var indexPaths: [IndexPath] = []
for molecule in molecules {
if let info = self.getMoleculeInfo(with: tmpMolecules as! ListItemModelProtocol) {
for molecule in tmpMolecules {
if let info = self.getMoleculeInfo(with: molecule) {
self.tableView?.register(info.class, forCellReuseIdentifier: info.identifier)
let index = indexPath.row + 1 + indexPaths.count
self.moleculesInfo?.insert(info, at: index)