From 5be8057fdbb6429db1ee9c615f995cb3f419c1f6 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 24 Jul 2020 18:09:05 +0530 Subject: [PATCH 1/3] 21804(iOS - List - Right Variable - Right Caret - All Text & Links) initial commit. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + ...htVariablePriceChangeAllTextAndLinks.swift | 2 +- ...ghtVariableRightCaretAlltextAndLinks.swift | 97 +++++++++++++++++++ ...riableRightCaretAlltextAndLinksModel.swift | 60 ++++++++++++ 5 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 36867c64..867f2854 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -213,6 +213,8 @@ AA26850E244840C300CE34CC /* HeadersH2TinyButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */; }; AA2AD116244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */; }; AA2AD118244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */; }; + AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */; }; + AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */; }; AA45AA0B24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */; }; AA45AA0D24BF0276007A6EA7 /* LockUpsPlanNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */; }; AA56A20F243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */; }; @@ -684,6 +686,8 @@ AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2TinyButtonModel.swift; sourceTree = ""; }; AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMedium.swift; sourceTree = ""; }; AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMediumModel.swift; sourceTree = ""; }; + AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAlltextAndLinksModel.swift; sourceTree = ""; }; + AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAlltextAndLinks.swift; sourceTree = ""; }; AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNamesModel.swift; sourceTree = ""; }; AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNames.swift; sourceTree = ""; }; AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDividerModel.swift; sourceTree = ""; }; @@ -1193,6 +1197,8 @@ C7F8012023E8303200396FBD /* ListRVWheel.swift */, D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */, D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */, + AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */, + AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */, ); path = RightVariable; sourceTree = ""; @@ -2329,6 +2335,7 @@ C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */, 0A7ECC702441001C00C828E8 /* UIToolbar+Extension.swift in Sources */, D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */, + AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift in Sources */, D209234F244F77FD0044AD09 /* ThreeLayerCenterTemplate.swift in Sources */, 525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */, 32D2609624C19E2100B56344 /* LockupsPlanSMLXL.swift in Sources */, @@ -2548,6 +2555,7 @@ D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */, 94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */, D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */, + AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift in Sources */, AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */, 011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */, D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index e8c6af54..4dd58eb7 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -183,6 +183,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeBodyText.self, viewModelClass: ListRightVariablePriceChangeBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeAllTextAndLinks.self, viewModelClass: ListRightVariablePriceChangeAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableToggleAllTextAndLinks.self, viewModelClass: ListRightVariableToggleAllTextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableRightCaretAlltextAndLinks.self, viewModelClass: ListRightVariableRightCaretAlltextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 65301304..2e07cb03 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -87,7 +87,7 @@ import Foundation //-------------------------------------------------- // MARK: - Accessibility //-------------------------------------------------- - + func getAccessibilityMessage() -> String? { guard let rightLabelText = rightLabel.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift new file mode 100644 index 00000000..3203ab05 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -0,0 +1,97 @@ +// +// ListRightVariableRightCaretAlltextAndLinks.swift +// MVMCoreUI +// +// Created by Lekshmi S on 23/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class ListRightVariableRightCaretAlltextAndLinks: TableViewCell { + + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + public let rightLabel = Label(fontStyle: .RegularBodySmall) + public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() + public var stack: Stack + + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill, verticalAlignment: .top))], axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - Lifecycle + //----------------------------------------------------- + open override func setupView() { + super.setupView() + rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) + addMolecule(stack) + stack.restack() + } + + //-------------------------------------------------- + // MARK: - Molecular + //-------------------------------------------------- + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListRightVariableRightCaretAlltextAndLinksModel else { return } + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + updateAccessibilityLabel() + } + + open override func reset() { + super.reset() + rightLabel.setFontStyle(.RegularBodySmall) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + //-------------------------------------------------- + // MARK: - Accessibility + //-------------------------------------------------- + func getAccessibilityMessage() -> String? { + guard let rightLabelText = rightLabel.text else { + return eyebrowHeadlineBodyLink.getAccessibilityMessage() + } + guard let label = eyebrowHeadlineBodyLink.getAccessibilityMessage() else { + return rightLabelText + } + return label + ", " + rightLabelText + } + + func updateAccessibilityLabel() { + let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 + isAccessibilityElement = !linkShowing + accessibilityTraits = (isAccessibilityElement && accessoryView != nil) ? .button : .none + if !linkShowing { + // Make whole cell focusable if no link. + accessibilityLabel = getAccessibilityMessage() + } else if let accessoryView = accessoryView { + // Both caret and link. Read all content on caret. + accessoryView.accessibilityLabel = getAccessibilityMessage() + accessibilityElements = [accessoryView, eyebrowHeadlineBodyLink.link] + } else { + // Only link. Manually add accessibility elements to ensure they are read in the right order. + var elements: [Any] = [] + if let otherElements = eyebrowHeadlineBodyLink.getAccessibilityElements() { + elements.append(otherElements) + } + if let rightLabelText = rightLabel.text, !rightLabelText.isEmpty { + elements.append(rightLabel) + } + accessibilityElements = elements + } + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift new file mode 100644 index 00000000..2ec60e64 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift @@ -0,0 +1,60 @@ +// +// ListRightVariableRightCaretAlltextAndLinksModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 23/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListRightVariableRightCaretAlltextAndLinksModel: ListItemModel, MoleculeModelProtocol { + + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public static var identifier: String = "listRVCaretAll" + public var rightLabel: LabelModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(rightLabel: LabelModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) { + self.rightLabel = rightLabel + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + override public func setDefaults() { + super.setDefaults() + rightLabel.hero = 0 + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case rightLabel + case eyebrowHeadlineBodyLink + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink) + 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(rightLabel, forKey: .rightLabel) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} From 7d3a542cfe4effd9536adfeb448725d4b0cd86a0 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Mon, 27 Jul 2020 13:55:32 +0530 Subject: [PATCH 2/3] Removed extra space. --- .../ListRightVariablePriceChangeAllTextAndLinks.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift index 2e07cb03..2364117b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePriceChangeAllTextAndLinks.swift @@ -87,7 +87,6 @@ import Foundation //-------------------------------------------------- // MARK: - Accessibility //-------------------------------------------------- - func getAccessibilityMessage() -> String? { guard let rightLabelText = rightLabel.text else { return eyebrowHeadlineBodyLink.getAccessibilityMessage() From 39739e5b7f13cc737720a99c42568fecb6f7350c Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 27 Jul 2020 14:29:00 -0400 Subject: [PATCH 3/3] Fix naming. Fix alignment --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++++++-------- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 2 +- ...ghtVariableRightCaretAlltextAndLinks.swift | 19 ++++++++++++++++--- ...riableRightCaretAlltextAndLinksModel.swift | 7 +------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 867f2854..7ebe581b 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -213,8 +213,8 @@ AA26850E244840C300CE34CC /* HeadersH2TinyButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */; }; AA2AD116244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */; }; AA2AD118244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */; }; - AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */; }; - AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */; }; + AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAllTextAndLinksModel.swift */; }; + AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAllTextAndLinks.swift */; }; AA45AA0B24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */; }; AA45AA0D24BF0276007A6EA7 /* LockUpsPlanNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */; }; AA56A20F243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */; }; @@ -686,8 +686,8 @@ AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2TinyButtonModel.swift; sourceTree = ""; }; AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMedium.swift; sourceTree = ""; }; AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMediumModel.swift; sourceTree = ""; }; - AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAlltextAndLinksModel.swift; sourceTree = ""; }; - AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAlltextAndLinks.swift; sourceTree = ""; }; + AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAllTextAndLinksModel.swift; sourceTree = ""; }; + AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariableRightCaretAllTextAndLinks.swift; sourceTree = ""; }; AA45AA0A24BF0263007A6EA7 /* LockUpsPlanNamesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNamesModel.swift; sourceTree = ""; }; AA45AA0C24BF0276007A6EA7 /* LockUpsPlanNames.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockUpsPlanNames.swift; sourceTree = ""; }; AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDividerModel.swift; sourceTree = ""; }; @@ -1197,8 +1197,8 @@ C7F8012023E8303200396FBD /* ListRVWheel.swift */, D2351C7924A4D433007DF0BC /* ListRightVariableToggleAllTextAndLinksModel.swift */, D2351C7B24A4D4C3007DF0BC /* ListRightVariableToggleAllTextAndLinks.swift */, - AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift */, - AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift */, + AA3561AB24C9684400452EB1 /* ListRightVariableRightCaretAllTextAndLinksModel.swift */, + AA3561AD24C96B9000452EB1 /* ListRightVariableRightCaretAllTextAndLinks.swift */, ); path = RightVariable; sourceTree = ""; @@ -2335,7 +2335,7 @@ C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */, 0A7ECC702441001C00C828E8 /* UIToolbar+Extension.swift in Sources */, D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */, - AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAlltextAndLinksModel.swift in Sources */, + AA3561AC24C9684400452EB1 /* ListRightVariableRightCaretAllTextAndLinksModel.swift in Sources */, D209234F244F77FD0044AD09 /* ThreeLayerCenterTemplate.swift in Sources */, 525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */, 32D2609624C19E2100B56344 /* LockupsPlanSMLXL.swift in Sources */, @@ -2555,7 +2555,7 @@ D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */, 94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */, D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */, - AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAlltextAndLinks.swift in Sources */, + AA3561AE24C96B9000452EB1 /* ListRightVariableRightCaretAllTextAndLinks.swift in Sources */, AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */, 011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */, D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 4dd58eb7..f2fba143 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -183,7 +183,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeBodyText.self, viewModelClass: ListRightVariablePriceChangeBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePriceChangeAllTextAndLinks.self, viewModelClass: ListRightVariablePriceChangeAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableToggleAllTextAndLinks.self, viewModelClass: ListRightVariableToggleAllTextAndLinksModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableRightCaretAlltextAndLinks.self, viewModelClass: ListRightVariableRightCaretAlltextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableRightCaretAllTextAndLinks.self, viewModelClass: ListRightVariableRightCaretAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift index 3203ab05..e7ba4f45 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinks.swift @@ -7,7 +7,7 @@ // import Foundation -@objcMembers open class ListRightVariableRightCaretAlltextAndLinks: TableViewCell { +@objcMembers open class ListRightVariableRightCaretAllTextAndLinks: TableViewCell { //-------------------------------------------------- // MARK: - Outlets @@ -20,7 +20,7 @@ import Foundation // MARK: - Initializers //-------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill, verticalAlignment: .top))], axis: .horizontal) + stack = Stack.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -38,12 +38,25 @@ import Foundation stack.restack() } + open override func alignAccessoryToHero() -> CGPoint? { + let heroCenter = super.alignAccessoryToHero() + + // Aligns the center of the right side items to the headline. + if let heroCenter = heroCenter, + let stackItem = stack.stackItems.last as? StackItem { + let convertedPoint = stack.convert(heroCenter, from: self) + stackItem.containerHelper.alignCenterVerticalConstraint?.constant = convertedPoint.y - stack.bounds.midY + } + + return heroCenter + } + //-------------------------------------------------- // MARK: - Molecular //-------------------------------------------------- open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) - guard let model = model as? ListRightVariableRightCaretAlltextAndLinksModel else { return } + guard let model = model as? ListRightVariableRightCaretAllTextAndLinksModel else { return } rightLabel.set(with: model.rightLabel, delegateObject, additionalData) eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) updateAccessibilityLabel() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift index 2ec60e64..025e808f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableRightCaretAlltextAndLinksModel.swift @@ -8,7 +8,7 @@ import Foundation -public class ListRightVariableRightCaretAlltextAndLinksModel: ListItemModel, MoleculeModelProtocol { +public class ListRightVariableRightCaretAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { //-------------------------------------------------- // MARK: - Properties @@ -26,11 +26,6 @@ public class ListRightVariableRightCaretAlltextAndLinksModel: ListItemModel, Mol super.init() } - override public func setDefaults() { - super.setDefaults() - rightLabel.hero = 0 - } - //-------------------------------------------------- // MARK: - Keys //--------------------------------------------------