code refactoring

This commit is contained in:
Damodaram 2020-03-13 13:57:38 +05:30
parent b5bbce6294
commit 1b3766e2b7

View File

@ -7,7 +7,7 @@
// //
import Foundation import Foundation
@objcMembers public class ListOneColumnTextWithWhitespaceDividerTall: TableViewCell { @objcMembers open class ListOneColumnTextWithWhitespaceDividerTall: TableViewCell {
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
@ -16,10 +16,11 @@ import Foundation
let headline = Label.commonLabelH3(true) let headline = Label.commonLabelH3(true)
let body = Label.commonLabelB2(true) let body = Label.commonLabelB2(true)
// MARK: - Initializers // MARK: - Initializers
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel(horizontalAlignment: .leading)),(view: body, model: StackItemModel(spacing: 5,horizontalAlignment: .leading))],axis: .vertical) stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel(horizontalAlignment: .leading)),
(view: body, model: StackItemModel(spacing: 5,horizontalAlignment: .leading))],
axis: .vertical)
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
} }
@ -34,16 +35,13 @@ import Foundation
super.setupView() super.setupView()
addMolecule(stack) addMolecule(stack)
stack.restack() stack.restack()
} }
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){
super.set(with: model, delegateObject, additionalData) super.set(with: model, delegateObject, additionalData)
guard let model = model as? ListOneColumnTextWithWhitespaceDividerTallModel else { return } guard let model = model as? ListOneColumnTextWithWhitespaceDividerTallModel else { return }
headline.setOptional(with: model.headline, delegateObject, additionalData) headline.set(with: model.headline, delegateObject, additionalData)
body.setOptional(with: model.body, delegateObject, additionalData) body.set(with: model.body, delegateObject, additionalData)
} }
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {