From e217970a0417c992676c342256c913094bfe0408 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 13 May 2020 19:41:17 +0530 Subject: [PATCH] Updated code as per confluence changes. --- .../List/ListProgressBarThin.swift | 21 ++++++------------- .../List/ListProgressBarThinModel.swift | 7 +------ 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift index 73561ec1..901e5b2d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThin.swift @@ -14,7 +14,6 @@ import Foundation let progressBar = ProgressBar() let leftHeadline = Label.commonLabelB1(true) let leftBody = Label.commonLabelB2(true) - let leftBody2 = Label.commonLabelB2(true) let bar = Line() let rightLabel = Label.commonLabelB2(true) private let barStackItem: StackItem @@ -27,25 +26,19 @@ import Foundation // MARK: - Initializers //------------------------------------------------------ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - //vertical stack with leftHeadline, leftBody, leftBody2 - let verticalStackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .leading, verticalAlignment: .leading), StackItemModel(horizontalAlignment: .leading), StackItemModel(horizontalAlignment: .leading)], - axis: .vertical, spacing: 0) - let verticalStackItems = [StackItem(andContain: leftHeadline), StackItem(andContain: leftBody), StackItem(andContain: leftBody2)] - verticalStack = Stack(with: verticalStackModel, stackItems: verticalStackItems) + //vertical stack with leftHeadline, leftBody + verticalStack = Stack.createStack(with: [leftHeadline, leftBody], axis: .vertical, spacing: 2) - //horizontal stack with leftHeadline, leftBody, leftBody2, bar, rightLabel + //horizontal stack with leftHeadline, leftBody, bar, rightLabel let horizontalStackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .leading), StackItemModel(horizontalAlignment: .fill), StackItemModel(spacing: 5, horizontalAlignment: .fill)], axis: .horizontal) barStackItem = StackItem(andContain: bar) rightLabelStackItem = StackItem(andContain: rightLabel) let horizontalStackItems = [StackItem(andContain: verticalStack), barStackItem, rightLabelStackItem] horizontalStack = Stack(with: horizontalStackModel, stackItems: horizontalStackItems) - + //stack with all components - let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), - StackItemModel(spacing: 20, horizontalAlignment: .fill)], axis: .vertical) - let stackItems = [StackItem(andContain: horizontalStack), StackItem(andContain: progressBar)] - stack = Stack(with: stackModel, stackItems: stackItems) + stack = Stack.createStack(with: [horizontalStack, progressBar], axis: .vertical, spacing: PaddingDefaultVerticalSpacing3) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -85,8 +78,7 @@ import Foundation super.set(with: model, delegateObject, additionalData) guard let model = model as? ListProgressBarThinModel else { return } verticalStack.updateContainedMolecules(with: [model.leftHeadline, - model.leftBody, - model.leftBody2],delegateObject, additionalData) + model.leftBody], delegateObject, additionalData) progressBar.set(with: model.progressBar, delegateObject, additionalData) bar.set(with: model.bar, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData) @@ -100,7 +92,6 @@ import Foundation super.reset() leftHeadline.styleB1(true) leftBody.styleB2(true) - leftBody2.styleB2(true) rightLabel.styleB2(true) bar.setStyle(.medium) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift index 7bed74b1..5c9c507b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ListProgressBarThinModel.swift @@ -12,15 +12,13 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol { public var progressBar: ProgressBarModel public var leftHeadline: LabelModel? public var leftBody: LabelModel? - public var leftBody2: LabelModel? public var bar: LineModel public var rightLabel: LabelModel - public init(progressBar: ProgressBarModel, leftHeadline: LabelModel, leftBody: LabelModel, leftBody2: LabelModel, bar: LineModel, rightLabel: LabelModel) { + public init(progressBar: ProgressBarModel, leftHeadline: LabelModel, leftBody: LabelModel, bar: LineModel, rightLabel: LabelModel) { self.progressBar = progressBar self.leftHeadline = leftHeadline self.leftBody = leftBody - self.leftBody2 = leftBody2 self.bar = bar self.rightLabel = rightLabel super.init() @@ -42,7 +40,6 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol { case progressBar case leftHeadline case leftBody - case leftBody2 case line case rightLabel } @@ -52,7 +49,6 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol { progressBar = try typeContainer.decode(ProgressBarModel.self, forKey:.progressBar) leftHeadline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .leftHeadline) leftBody = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .leftBody) - leftBody2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .leftBody2) bar = try typeContainer.decode(LineModel.self, forKey: .line) rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) try super.init(from: decoder) @@ -65,7 +61,6 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol { try container.encode(progressBar, forKey: .progressBar) try container.encodeIfPresent(leftHeadline, forKey: .leftHeadline) try container.encodeIfPresent(leftBody, forKey: .leftBody) - try container.encodeIfPresent(leftBody2, forKey: .leftBody2) try container.encode(bar, forKey: .line) try container.encode(rightLabel, forKey: .rightLabel) }