diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 7ed0a2e3..4afd3a24 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -995,8 +995,8 @@ D22B38EB23F4E0AE00490EF6 /* LeftVariable */ = { isa = PBXGroup; children = ( - 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */, 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */, + 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */, 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, ); diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift index d83e8389..553e6359 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift @@ -9,11 +9,11 @@ import Foundation @objcMembers public class ListLeftVariableCheckboxAllTextAndLinks: TableViewCell { - - let checkbox = Checkbox(frame: .zero) - let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) - let stack = Stack(frame: .zero) + public let checkbox = Checkbox(frame: .zero) + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero) + public let stack = Stack(frame: .zero) + // MARK: - View Lifecycle open override func updateView(_ size: CGFloat) { super.updateView(size) stack.updateView(size) @@ -21,20 +21,18 @@ import Foundation override open func setupView() { super.setupView() - guard checkbox.superview == nil else { - return - } - stack.translatesAutoresizingMaskIntoConstraints = false stack.stackItems = [StackItem(andContain: checkbox),StackItem(andContain: eyebrowHeadlineBodyLink)] contentView.addSubview(stack) containerHelper.constrainView(stack) } + // MARK:- ModelMoleculeViewProtocol override open func reset() { super.reset() stack.reset() } + // MARK:- MVMCoreUIMoleculeViewProtocol public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.setWithModel(model, delegateObject, additionalData) guard let model = model as? ListLeftVariableCheckboxAllTextAndLinksModel else { return} @@ -42,13 +40,17 @@ import Foundation eyebrowHeadlineBodyLink.setWithModel(model.eyebrowHeadlineBodyLink, delegateObject, additionalData) // Create a stack model to use for the internal stack and set the alignment of labels - let checkbox = StackItemModel(percent: 10) - checkbox.horizontalAlignment = .leading - let eyebrowHeadlineBodyLink = StackItemModel(percent: 90) - eyebrowHeadlineBodyLink.horizontalAlignment = .fill + let checkbox = StackItemModel() + checkbox.horizontalAlignment = .fill + let eyebrowHeadlineBodyLink = StackItemModel() + eyebrowHeadlineBodyLink.horizontalAlignment = .leading let stackModel = StackModel(molecules: [checkbox,eyebrowHeadlineBodyLink]) stackModel.axis = .horizontal stack.model = stackModel stack.restack() } + + public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 140 + } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift index 80ab9506..2fb89b1e 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift @@ -9,12 +9,11 @@ import Foundation public class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "listLVCB" public var checkbox: CheckboxModel - var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel - init(checkbox: CheckboxModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + public init(checkbox: CheckboxModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { self.checkbox = checkbox self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink super.init() diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 76eb447f..8f206e35 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -21,9 +21,6 @@ import UIKit // MARK: - MFViewProtocol open override func setupView() { super.setupView() - guard stack.superview == nil else { - return - } stack.stackItems = [StackItem(andContain: eyebrow),StackItem(andContain: headline),StackItem(andContain: body),StackItem(andContain: link)] addSubview(stack) NSLayoutConstraint.constraintPinSubview(toSuperview: stack) diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift index e63d69e2..913933d9 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift @@ -8,10 +8,10 @@ import Foundation -struct EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol { - static var identifier: String = "eyebrowHeadlineBodyLink" - var backgroundColor: Color? - var moleculeName: String? = EyebrowHeadlineBodyLinkModel.identifier +public struct EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol { + public static var identifier: String = "eyebrowHeadlineBodyLink" + public var moleculeName: String? = EyebrowHeadlineBodyLinkModel.identifier + public var backgroundColor: Color? public var eyebrow: LabelModel? public var headline: LabelModel? public var body: LabelModel?