From 965dcf538b5239929f94dab4b6df0705dafbde50 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Tue, 11 Feb 2020 12:18:45 +0530 Subject: [PATCH] Class naming convention changed and removed init methods where not required. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++++------ ... ListLeftVariableIconWithRightCaret.swift} | 26 +++++-------------- ...LeftVariableIconWithRightCaretModel.swift} | 10 +++---- .../OtherHandlers/MoleculeObjectMapping.swift | 2 +- 4 files changed, 18 insertions(+), 36 deletions(-) rename MVMCoreUI/Molecules/LeftRightViews/{LeftVariableIconRightCaretList.swift => ListLeftVariableIconWithRightCaret.swift} (83%) rename MVMCoreUI/Molecules/LeftRightViews/{LeftVariableIconRightCaretListModel.swift => ListLeftVariableIconWithRightCaretModel.swift} (83%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index e17401e0..e02f3542 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -95,8 +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 */; }; + 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; + 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.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 */; }; @@ -414,8 +414,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 = ""; }; + 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; + 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.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 = ""; }; @@ -897,8 +897,8 @@ isa = PBXGroup; children = ( D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */, - 8D24041023E7FB9E009E23BE /* LeftVariableIconRightCaretList.swift */, - 8D24041423E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift */, + 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, + 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, 0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */, D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */, 01509D902327ECE600EF99AA /* CornerLabels.swift */, @@ -1694,7 +1694,7 @@ 94AF4A3F23E9D13900676048 /* MFCaretButton.m in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */, - 8D24041523E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift in Sources */, + 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */, D28A838F23CCDEDE00DFE4FC /* TwoButtonViewModel.swift in Sources */, 012A88B1238C880100FE3DA1 /* CarouselPagingModelProtocol.swift in Sources */, D29DF2C921E7BFC6003B2FB9 /* MFSizeObject.m in Sources */, @@ -1707,7 +1707,7 @@ D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, D29DF16121E69996003B2FB9 /* MFViewController.m in Sources */, 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, - 8D24041123E7FB9E009E23BE /* LeftVariableIconRightCaretList.swift in Sources */, + 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.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/ListLeftVariableIconWithRightCaret.swift similarity index 83% rename from MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretList.swift rename to MVMCoreUI/Molecules/LeftRightViews/ListLeftVariableIconWithRightCaret.swift index c35678a2..7a6ac9be 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretList.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ListLeftVariableIconWithRightCaret.swift @@ -1,5 +1,5 @@ // -// LeftVariableIconRightCaretList.swift +// ListLeftVariableIconWithRightCaret.swift // MVMCoreUI // // Created by Kruthika KP on 03/02/20. @@ -9,7 +9,7 @@ import Foundation import UIKit -@objcMembers public class LeftVariableIconRightCaretList: TableViewCell { +@objcMembers public class ListLeftVariableIconWithRightCaret: TableViewCell { //----------------------------------------------------- // MARK: - Outlets @@ -18,7 +18,7 @@ import UIKit let leftImage = MFLoadImageView() let leftLabel = Label.commonLabelB2(true) let rightLabel = Label.commonLabelB2(true) - let containerView = ViewConstrainingView() + let containerView = Container() //------------------------------------------------------ // MARK: - Properties @@ -29,21 +29,7 @@ import UIKit let spaceBetweenImageAndLeftLabel: CGFloat = 16 let imageSize: CGFloat = 30 let spaceBetweenLabels: CGFloat = 40 - let rightPadding: CGFloat = 54 - - //------------------------------------------------------ - // 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) - } - + //----------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- @@ -90,7 +76,7 @@ import UIKit rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor, constant: spaceBetweenLabels).isActive = true rightLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true rightLabel.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true - containerView.trailingAnchor.constraint(equalTo: rightLabel.trailingAnchor,constant: rightPadding).isActive = true + containerView.trailingAnchor.constraint(equalTo: rightLabel.trailingAnchor,constant: PaddingNine).isActive = true } //---------------------------------------------------- @@ -106,7 +92,7 @@ import UIKit public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.setWithModel(model, delegateObject, additionalData) - guard let model = model as? LeftVariableIconRightCaretListModel else { return} + guard let model = model as? ListLeftVariableIconWithRightCaretModel 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/ListLeftVariableIconWithRightCaretModel.swift similarity index 83% rename from MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretListModel.swift rename to MVMCoreUI/Molecules/LeftRightViews/ListLeftVariableIconWithRightCaretModel.swift index dab0b153..b29affb8 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/LeftVariableIconRightCaretListModel.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/ListLeftVariableIconWithRightCaretModel.swift @@ -1,5 +1,5 @@ // -// LeftVariableIconRightCaretListModel.swift +// ListLeftVariableIconWithRightCaretModel.swift // MVMCoreUI // // Created by Kruthika KP on 03/02/20. @@ -8,7 +8,7 @@ import Foundation -public class LeftVariableIconRightCaretListModel: ContainerModel, ListItemModelProtocol { +public class ListLeftVariableIconWithRightCaretModel: ContainerModel, ListItemModelProtocol { public var line: LineModel? public var hideArrow: Bool? = false @@ -39,7 +39,6 @@ public class LeftVariableIconRightCaretListModel: ContainerModel, ListItemModelP self.leftLabel = leftLabel self.rightLabel = rightLabel super.init() - setDefaults() } private enum CodingKeys: String, CodingKey { @@ -48,7 +47,6 @@ public class LeftVariableIconRightCaretListModel: ContainerModel, ListItemModelP case rightLabel case image case action - case hideArrow } required public init(from decoder: Decoder) throws { @@ -57,7 +55,6 @@ public class LeftVariableIconRightCaretListModel: ContainerModel, ListItemModelP rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) image = try typeContainer.decode(ImageViewModel.self, forKey: .image) action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) - hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) try super.init(from: decoder) setDefaults() } @@ -65,12 +62,11 @@ public class LeftVariableIconRightCaretListModel: ContainerModel, ListItemModelP public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(LeftVariableIconRightCaretListModel.identifier, forKey: .moleculeName) + try container.encode(ListLeftVariableIconWithRightCaretModel.identifier, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) try container.encode(rightLabel, forKey: .rightLabel) try container.encode(image, forKey: .image) try container.encodeModelIfPresent(action, forKey: .action) - try container.encodeIfPresent(hideArrow, forKey: .hideArrow) } } diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index a87dac90..34af5083 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -70,7 +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) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) // List items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: ListItemModel.self)