Code changes after review.

This commit is contained in:
Lekshmi S 2020-10-27 11:31:14 +05:30
parent 10b153489d
commit 77b62f0213
2 changed files with 21 additions and 34 deletions

View File

@ -6,8 +6,6 @@
// Copyright © 2020 Verizon Wireless. All rights reserved. // Copyright © 2020 Verizon Wireless. All rights reserved.
// //
import Foundation
@objcMembers open class ListStoreLocator: TableViewCell { @objcMembers open class ListStoreLocator: TableViewCell {
//-------------------------------------------------- //--------------------------------------------------
@ -17,36 +15,27 @@ import Foundation
public let leftHeadline = Label(fontStyle: .BoldBodySmall) public let leftHeadline = Label(fontStyle: .BoldBodySmall)
public let leftBody = Label(fontStyle: .RegularBodySmall) public let leftBody = Label(fontStyle: .RegularBodySmall)
public let leftSubBody = Label(fontStyle: .RegularBodySmall) public let leftSubBody = Label(fontStyle: .RegularBodySmall)
public let rightLabel = Label(fontStyle: .BoldBodySmall) public let rightLabel = Label(fontStyle: .RegularBodySmall)
public var horizontalStack: Stack<StackModel> private lazy var rightLabelStackItem: StackItem = {
private let rightLabelStackItem: StackItem return StackItem(andContain: rightLabel)
public var stack: Stack<StackModel> }()
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<StackModel> = {
return Stack<StackModel>(with: horizontalStackModel, stackItems: horizontalStackItems)
}()
public lazy var stack: Stack<StackModel> = {
return Stack<StackModel>.createStack(with: [horizontalStack, leftBody, leftSubBody], axis: .vertical, spacing: 0)
}()
public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: 12, standardiPadPortraitSize: 18) 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<StackModel>(with: horizontalStackModel, stackItems: horizontalStackItems)
//stack with all components
stack = Stack<StackModel>.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 // MARK: - Lifecycle
//------------------------------------------------------- //-------------------------------------------------------
@ -127,7 +116,7 @@ import Foundation
if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty { if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty {
message += rightLabelText message += rightLabelText
} }
return message return message.count > 0 ? message : nil
} }
func updateAccessibilityLabel() { func updateAccessibilityLabel() {

View File

@ -6,14 +6,12 @@
// Copyright © 2020 Verizon Wireless. All rights reserved. // Copyright © 2020 Verizon Wireless. All rights reserved.
// //
import Foundation
public class ListStoreLocatorModel: ListItemModel, MoleculeModelProtocol { public class ListStoreLocatorModel: ListItemModel, MoleculeModelProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public static var identifier = "listStrLctr" public static var identifier = "listStoreLoctr"
public var heart: HeartModel public var heart: HeartModel
public var leftHeadline: LabelModel public var leftHeadline: LabelModel
public var leftBody: LabelModel public var leftBody: LabelModel