Molecule List. Back to view instead of margins for stack due to background color issues. Standard Header View to margin for internal use.
35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
//
|
|
// MoleculeTableViewCell.swift
|
|
// MVMCoreUI
|
|
//
|
|
// Created by Scott Pfeil on 4/18/19.
|
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
@objcMembers open class MoleculeTableViewCell: UITableViewCell, MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol {
|
|
var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
|
|
|
public func updateView(_ size: CGFloat) {
|
|
if let molecule = molecule as? MVMCoreViewProtocol {
|
|
molecule.updateView(size)
|
|
}
|
|
}
|
|
|
|
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) {
|
|
guard let json = json else {
|
|
return
|
|
}
|
|
if molecule == nil {
|
|
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeForJSON(json, delegateObject: delegateObject) {
|
|
addSubview(moleculeView)
|
|
NSLayoutConstraint.constraintPinSubview(toSuperview: moleculeView)
|
|
molecule = moleculeView
|
|
}
|
|
} else {
|
|
molecule?.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
|
}
|
|
}
|
|
}
|