diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 177f4b1a..362a823f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -6,8 +6,6 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - @objcMembers open class ListStoreLocator: TableViewCell { //-------------------------------------------------- @@ -17,36 +15,27 @@ import Foundation public let leftHeadline = Label(fontStyle: .BoldBodySmall) public let leftBody = Label(fontStyle: .RegularBodySmall) public let leftSubBody = Label(fontStyle: .RegularBodySmall) - public let rightLabel = Label(fontStyle: .BoldBodySmall) - public var horizontalStack: Stack - private let rightLabelStackItem: StackItem - public var stack: Stack - + public let rightLabel = Label(fontStyle: .RegularBodySmall) + private lazy var rightLabelStackItem: StackItem = { + return StackItem(andContain: rightLabel) + }() + private lazy var horizontalStackItems: [StackItem] = { + return [StackItem(andContain: leftHeadline), StackItem(andContain: heart), rightLabelStackItem] + }() + private lazy var horizontalStackModel: StackModel = { + return StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), + StackItemModel(horizontalAlignment: .fill), + StackItemModel(horizontalAlignment: .trailing)], + axis: .horizontal, spacing: Padding.Two) + }() + public lazy var horizontalStack: Stack = { + return Stack(with: horizontalStackModel, stackItems: horizontalStackItems) + }() + public lazy var stack: Stack = { + return Stack.createStack(with: [horizontalStack, leftBody, leftSubBody], axis: .vertical, spacing: 0) + }() public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: 12, standardiPadPortraitSize: 18) - //------------------------------------------------------ - // MARK: - Initializers - //------------------------------------------------------ - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - - let horizontalStackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), - StackItemModel(horizontalAlignment: .fill), - StackItemModel(horizontalAlignment: .trailing)], - axis: .horizontal, spacing: 8) - rightLabelStackItem = StackItem(andContain: rightLabel) - let horizontalStackItems = [StackItem(andContain: leftHeadline), StackItem(andContain: heart), rightLabelStackItem] - //horizontal stack with leftHeadline, heart, rightLabel - horizontalStack = Stack(with: horizontalStackModel, stackItems: horizontalStackItems) - - //stack with all components - stack = Stack.createStack(with: [horizontalStack, leftBody, leftSubBody], axis: .vertical, spacing: 0) - super.init(style: style, reuseIdentifier: reuseIdentifier) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - //------------------------------------------------------- // MARK: - Lifecycle //------------------------------------------------------- @@ -127,7 +116,7 @@ import Foundation if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty { message += rightLabelText } - return message + return message.count > 0 ? message : nil } func updateAccessibilityLabel() { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocatorModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocatorModel.swift index 0fed6749..52f9f9fc 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocatorModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocatorModel.swift @@ -6,14 +6,12 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // -import Foundation - public class ListStoreLocatorModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public static var identifier = "listStrLctr" + public static var identifier = "listStoreLoctr" public var heart: HeartModel public var leftHeadline: LabelModel public var leftBody: LabelModel