From bb87cac010dccbfd4be1a6868ead84f022f13120 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Sun, 26 Apr 2020 00:40:09 +0530 Subject: [PATCH 1/5] removed space --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index b8ffb9e6..436db9d5 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -118,7 +118,6 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: MoleculeCollectionItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: CarouselItem.self, viewModelClass: CarouselItemModel.self) - // Other Container Molecules MoleculeObjectMapping.shared()?.register(viewClass: MoleculeContainer.self, viewModelClass: MoleculeContainerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MoleculeHeaderView.self, viewModelClass: MoleculeHeaderModel.self) From 6191dbb1905e31c48ff644be8142887b20102c20 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Sun, 26 Apr 2020 00:43:09 +0530 Subject: [PATCH 2/5] Revert "removed space" This reverts commit bb87cac010dccbfd4be1a6868ead84f022f13120. --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 436db9d5..b8ffb9e6 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -118,6 +118,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: MoleculeCollectionItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: CarouselItem.self, viewModelClass: CarouselItemModel.self) + // Other Container Molecules MoleculeObjectMapping.shared()?.register(viewClass: MoleculeContainer.self, viewModelClass: MoleculeContainerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MoleculeHeaderView.self, viewModelClass: MoleculeHeaderModel.self) From 136b2d3f39e783acc43143489fc5480fbd8aecb8 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Fri, 12 Jun 2020 15:38:08 +0530 Subject: [PATCH 3/5] Initial commit - List_LeftVariable_NumberedList_BodyText --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + ...ListLeftVariableNumberedListBodyText.swift | 90 +++++++++++++++++++ ...eftVariableNumberedListBodyTextModel.swift | 58 ++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 3af65c10..114dd245 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -116,6 +116,8 @@ 27F9736A246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27F97369246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; + 324FB6AA249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324FB6A9249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift */; }; + 324FB6AC24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 324FB6AB24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift */; }; 32F8804624765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32F8804524765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift */; }; 32F8804824765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32F8804724765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift */; }; 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; @@ -561,6 +563,8 @@ 27F97369246750BE00CAB5C5 /* ScreenBrightnessModifierBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenBrightnessModifierBehavior.swift; sourceTree = ""; }; 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxLabelModel.swift; sourceTree = ""; }; 31BE15CA23D8924C00452370 /* CheckboxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxModel.swift; sourceTree = ""; }; + 324FB6A9249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListBodyTextModel.swift; sourceTree = ""; }; + 324FB6AB24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListBodyText.swift; sourceTree = ""; }; 32F8804524765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListAllTextAndLinksModel.swift; sourceTree = ""; }; 32F8804724765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableNumberedListAllTextAndLinks.swift; sourceTree = ""; }; 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = ""; }; @@ -1354,6 +1358,8 @@ AA997251247530B100FC7472 /* ListLeftVariableIconAllTextLinks.swift */, 32F8804524765C6E00C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinksModel.swift */, 32F8804724765C8400C2ACB3 /* ListLeftVariableNumberedListAllTextAndLinks.swift */, + 324FB6A9249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift */, + 324FB6AB24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift */, ); path = LeftVariable; sourceTree = ""; @@ -2053,6 +2059,7 @@ files = ( 0A775F2624893916009EFB58 /* ThreeHeadlineBodyLink.swift in Sources */, AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */, + 324FB6AA249366F3002552C7 /* ListLeftVariableNumberedListBodyTextModel.swift in Sources */, 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */, AA0A257824766C8A00862F64 /* ListLeftVariableIconWithRightCaretBodyTextModel.swift in Sources */, 0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */, @@ -2309,6 +2316,7 @@ BB6C6AC0242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift in Sources */, 8DEFA95E243DAC2F000D27E5 /* ListThreeColumnDataUsageDivider.swift in Sources */, D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, + 324FB6AC24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift in Sources */, AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */, 522679C223FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift in Sources */, AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 98b1e6a3..508181cc 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -172,6 +172,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableCheckboxBodyText.self, viewModelClass: ListLeftVariableCheckboxBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableIconAllTextLinks.self, viewModelClass: ListLeftVariableIconAllTextLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableNumberedListAllTextAndLinks.self, viewModelClass: ListLeftVariableNumberedListAllTextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableNumberedListBodyText.self, viewModelClass: ListLeftVariableNumberedListBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift new file mode 100644 index 00000000..c63b3e1a --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -0,0 +1,90 @@ +// +// ListLeftVariableNumberedListBodyText.swift +// MVMCoreUI +// +// Created by Subhankar Acharya on 12/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListLeftVariableNumberedListBodyText: TableViewCell { + //-------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + public let leftLabel = Label(fontStyle: .Title2XLarge) + public let headlineBody = HeadlineBody() + public var stack: Stack + + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- + + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 10, horizontalAlignment: .fill)), + (view: headlineBody, model: StackItemModel(percent: 90, horizontalAlignment: .fill))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //-------------------------------------------------- + // MARK: - Life Cycle + //-------------------------------------------------- + override open func setupView() { + super.setupView() + leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) + addMolecule(stack) + stack.restack() + updateAccessibilityLabel() + } + + //--------------------------------------------------- + // MARK: - Molecule + //--------------------------------------------------- + + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + + guard let model = model as? ListLeftVariableNumberedListBodyTextModel else { return } + leftLabel.text = String(model.number) + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + updateAccessibilityLabel() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 140 + } + + open override func reset() { + super.reset() + leftLabel.setFontStyle(.Title2XLarge) + } + + //-------------------------------------------------- + // MARK: - Accessibility + //-------------------------------------------------- + + func updateAccessibilityLabel() { + + var message = "" + + if let leftLabel = leftLabel.text { + message += leftLabel + ", " + } + + if let headlineLabel = headlineBody.headlineLabel.text { + message += headlineLabel + ", " + } + + if let messageLabel = headlineBody.messageLabel.text { + message += messageLabel + } + + accessibilityLabel = message + } +} + diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift new file mode 100644 index 00000000..372bab32 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyTextModel.swift @@ -0,0 +1,58 @@ +// +// ListLeftVariableNumberedListBodyTextModel.swift +// MVMCoreUI +// +// Created by Subhankar Acharya on 12/06/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListLeftVariableNumberedListBodyTextModel: ListItemModel, MoleculeModelProtocol { + //----------------------------------------------------- + // MARK: - Properties + //----------------------------------------------------- + + public static var identifier: String = "listLVNLBdy" + public var number: Int + public var headlineBody: HeadlineBodyModel + + //----------------------------------------------------- + // MARK: - Initializer + //----------------------------------------------------- + + public init(number: Int, headlineBody: HeadlineBodyModel) { + self.number = number + self.headlineBody = headlineBody + super.init() + } + + //----------------------------------------------------- + // MARK: - Keys + //----------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case number + case headlineBody + } + + //----------------------------------------------------- + // MARK: - Codec + //----------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + number = try typeContainer.decode(Int.self, forKey: .number) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(number, forKey: .number) + try container.encode(headlineBody, forKey: .headlineBody) + } +} From 5502dd22f7f74503e7435af774e283be8026a2d3 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Tue, 16 Jun 2020 15:16:35 +0530 Subject: [PATCH 4/5] Changes for alignment issue in iPhone 11 simulator and accessibility updates --- .../ListLeftVariableNumberedListBodyText.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index c63b3e1a..572ede57 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -21,8 +21,9 @@ import Foundation //-------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 10, horizontalAlignment: .fill)), - (view: headlineBody, model: StackItemModel(percent: 90, horizontalAlignment: .fill))], + + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)), + (view: headlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -36,10 +37,10 @@ import Foundation //-------------------------------------------------- override open func setupView() { super.setupView() - leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) + leftLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + leftLabel.setContentHuggingPriority(.defaultHigh, for: .vertical) addMolecule(stack) stack.restack() - updateAccessibilityLabel() } //--------------------------------------------------- @@ -70,6 +71,8 @@ import Foundation func updateAccessibilityLabel() { + isAccessibilityElement = true + var message = "" if let leftLabel = leftLabel.text { @@ -85,6 +88,7 @@ import Foundation } accessibilityLabel = message + accessibilityTraits = (accessoryView != nil) ? .button : .none } } From 9d1e1f4f4ba284628d8442a81ce6f0df001f6624 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Tue, 16 Jun 2020 20:16:52 +0530 Subject: [PATCH 5/5] Added horizontal hugging priority --- .../List/LeftVariable/ListLeftVariableNumberedListBodyText.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift index 572ede57..a0a7a462 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListBodyText.swift @@ -39,6 +39,7 @@ import Foundation super.setupView() leftLabel.setContentCompressionResistancePriority(.required, for: .horizontal) leftLabel.setContentHuggingPriority(.defaultHigh, for: .vertical) + leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) addMolecule(stack) stack.restack() }