diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift index d43bf876..f32e0797 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift @@ -14,36 +14,36 @@ import Foundation // MARK: - Outlets //----------------------------------------------------- var stack: Stack - let headlineBody = HeadlineBody() + let headlineBody = HeadlineBody(frame: .zero) //----------------------------------------------------- // MARK: - Initializers //----------------------------------------------------- - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [headlineBody]) - super.init(style: style, reuseIdentifier: reuseIdentifier) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [headlineBody]) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } //----------------------------------------------------- // MARK: - View Lifecycle //----------------------------------------------------- - override open func setupView() { - super.setupView() - addMolecule(stack) - } - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ - super.set(with: model, delegateObject, additionalData) - guard let model = model as? ListOneColumnFullWidthTextBodyTextModel else { return } - headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + override open func setupView() { + super.setupView() + addMolecule(stack) + } + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){ + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListOneColumnFullWidthTextBodyTextModel else { return } + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) stack.restack() - -} + } + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { - return 90 - } + return 90 + } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift index 6051b340..5109316a 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift @@ -11,16 +11,22 @@ import Foundation public class ListOneColumnFullWidthTextBodyTextModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "list1CFWBdy" public var headlineBody: HeadlineBodyModel - + public init(headlineBody: HeadlineBodyModel) { self.headlineBody = headlineBody super.init() + setDefaults() + } + + // Defaults to set + override public func setDefaults() { + super.setDefaults() + headlineBody.style = "item" } private enum CodingKeys: String, CodingKey { case moleculeName case headlineBody - } required public init(from decoder: Decoder) throws { @@ -34,6 +40,5 @@ public class ListOneColumnFullWidthTextBodyTextModel: ListItemModel, MoleculeMod var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encode(headlineBody, forKey: .headlineBody) - } }