From 4bcfdb96db51ad11ac998c223dcb81ddee23d2a1 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Wed, 5 Feb 2020 13:17:50 +0530 Subject: [PATCH] 18936 - Left Variable Icon - with - Right Caret - initial commit. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ .../LeftVariableIconRightCaretList.swift | 115 ++++++++++++++++++ .../LeftVariableIconRightCaretListModel.swift | 39 ++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 163 insertions(+) create mode 100644 MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretList.swift create mode 100644 MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretListModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index a35514cb..7cc6f284 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -95,6 +95,8 @@ 0AE14F64238315D2005417F8 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14F63238315D2005417F8 /* TextField.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; + 8D24041123E7FB9E009E23BE /* LeftVariableIconRightCaretList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* LeftVariableIconRightCaretList.swift */; }; + 8D24041523E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift */; }; 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */; }; 943784F5236B77BB006A1E82 /* GraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F3236B77BB006A1E82 /* GraphView.swift */; }; 943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */; }; @@ -408,6 +410,8 @@ 0AE14F63238315D2005417F8 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.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 = ""; }; + 8D24041023E7FB9E009E23BE /* LeftVariableIconRightCaretList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftVariableIconRightCaretList.swift; sourceTree = ""; }; + 8D24041423E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftVariableIconRightCaretListModel.swift; sourceTree = ""; }; 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = ""; }; 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntryFieldContainer.swift; sourceTree = ""; }; 943784F3236B77BB006A1E82 /* GraphView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphView.swift; sourceTree = ""; }; @@ -881,6 +885,8 @@ isa = PBXGroup; children = ( D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */, + 8D24041023E7FB9E009E23BE /* LeftVariableIconRightCaretList.swift */, + 8D24041423E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift */, 0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */, D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */, 01509D902327ECE600EF99AA /* CornerLabels.swift */, @@ -1673,6 +1679,7 @@ C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */, + 8D24041523E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift in Sources */, D28A838F23CCDEDE00DFE4FC /* TwoButtonViewModel.swift in Sources */, 012A88B1238C880100FE3DA1 /* CarouselPagingModelProtocol.swift in Sources */, D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */, @@ -1685,6 +1692,7 @@ D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, D29DF16121E69996003B2FB9 /* MFViewController.m in Sources */, 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, + 8D24041123E7FB9E009E23BE /* LeftVariableIconRightCaretList.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */, 0A21DB89235E06EF00C160A2 /* MFMdnTextField.m in Sources */, diff --git a/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretList.swift b/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretList.swift new file mode 100644 index 00000000..ba540437 --- /dev/null +++ b/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretList.swift @@ -0,0 +1,115 @@ +// +// LeftVariableIconRightCaretList.swift +// MVMCoreUI +// +// Created by Kruthika KP on 03/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +import UIKit + +@objcMembers public class LeftVariableIconRightCaretList : TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + + let leftImage = MFLoadImageView() + let leftLabel = Label.commonLabelB2(true) + let rightLabel = Label.commonLabelB2(true) + + + //------------------------------------------------------ + // MARK: - Properties + //------------------------------------------------------- + let spaceBetweenLabels : CGFloat = 40 + let horizontalPadding : CGFloat = 10 + let rightLabelTrailing : CGFloat = 20 + let cellHeight : CGFloat = 60 + let imageSize : CGFloat = 30 + + + //------------------------------------------------------ + // MARK: - Initialization + //-------------------------------------------------------- + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + setupView() + } + + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setupView() + } + + + //----------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + leftImage.updateView(size) + leftLabel.updateView(size) + rightLabel.updateView(size) + + } + + override open func setupView() { + super.setupView() + guard leftImage.superview == nil else { + return + } + + addSubview(leftImage) + addSubview(leftLabel) + addSubview(rightLabel) + + + contentView.heightAnchor.constraint(equalToConstant: cellHeight).isActive = true + + leftImage.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor, constant: horizontalPadding).isActive = true + leftImage.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor).isActive = true + leftImage.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor).isActive = true + leftImage.widthAnchor.constraint(equalToConstant: imageSize).isActive = true + leftImage.heightAnchor.constraint(equalToConstant: imageSize).isActive = true + + leftLabel.leadingAnchor.constraint(equalTo: leftImage.trailingAnchor, constant: horizontalPadding).isActive = true + leftLabel.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor).isActive = true + leftLabel.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor).isActive = true + + + rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor, constant: spaceBetweenLabels).isActive = true + rightLabel.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor).isActive = true + rightLabel.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor).isActive = true + layoutMarginsGuide.trailingAnchor.constraint(equalTo: rightLabel.trailingAnchor, constant: rightLabelTrailing).isActive = true + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + + override open func reset() { + super.reset() + + leftImage.reset() + leftLabel.reset() + rightLabel.reset() + } + + open func setAsMolecule() { + setupView() + } + + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? LeftVariableIconRightCaretListModel else { return} + + leftImage.setWithModel(model.image, delegateObject, additionalData) + leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) + rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData) + } +} diff --git a/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretListModel.swift b/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretListModel.swift new file mode 100644 index 00000000..e0ee0fcb --- /dev/null +++ b/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretListModel.swift @@ -0,0 +1,39 @@ +// +// LeftVariableIconRightCaretListModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 03/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class LeftVariableIconRightCaretListModel: ListItemModelProtocol { + + public var horizontalAlignment: UIStackView.Alignment? + public var verticalAlignment: UIStackView.Alignment? + public var useHorizontalMargins: Bool? + public var useVerticalMargins: Bool? + public var topMarginPadding: CGFloat? + public var bottomMarginPadding: CGFloat? + + + public var line: LineModel? = LineModel(type: .standard) + public var hideArrow: Bool? = false + public var backgroundColor: Color? + + public static var identifier: String = "listLVImg" + public var image: ImageViewModel + public var leftLabel: LabelModel + public var rightLabel: LabelModel + + + + public init(image: ImageViewModel, leftLabel: LabelModel, rightLabel: LabelModel) { + self.image = image + self.leftLabel = leftLabel + self.rightLabel = rightLabel + } + +} + diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index d3523ccf..0bb12509 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -70,6 +70,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LeftVariableIconRightCaretList.self, viewModelClass: LeftVariableIconRightCaretListModel.self) // List items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: ListItemModel.self)