From 8612b34ac7c3fabe98ebfadd4d6e1cb8d9c9c290 Mon Sep 17 00:00:00 2001 From: panxi Date: Fri, 13 Dec 2019 11:26:48 -0500 Subject: [PATCH] update listitem --- MVMCoreUI.xcodeproj/project.pbxproj | 6 +---- MVMCoreUI/Atoms/Views/DashLineModel.swift | 4 +--- .../Atoms/Views/LeftRightLabelModel.swift | 6 ++--- .../Atoms/Views/MultiProgressModel.swift | 4 +--- MVMCoreUI/Atoms/Views/ProgressBarModel.swift | 4 +--- .../ListItemModelProtocol.swift | 2 +- .../Molecules/DropDownListItemModel.swift | 4 ++-- MVMCoreUI/Models/Molecules/HeaderModel.swift | 6 ++--- MVMCoreUI/Models/Molecules/LineModel.swift | 4 ---- .../Models/Molecules/SeperatorModel.swift | 15 ------------ .../Items}/ListItemModel.swift | 24 +++++++------------ .../OtherHandlers/MoleculeObjectMapping.swift | 1 - 12 files changed, 20 insertions(+), 60 deletions(-) delete mode 100644 MVMCoreUI/Models/Molecules/SeperatorModel.swift rename MVMCoreUI/{Models/Molecules => Molecules/Items}/ListItemModel.swift (61%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index d9f4c2ff..f50573f6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -27,7 +27,6 @@ 012A88EC238F084D00FE3DA1 /* FooterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88EB238F084D00FE3DA1 /* FooterModel.swift */; }; 012A88EE239858E300FE3DA1 /* ContainerMoleculeProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88ED239858E300FE3DA1 /* ContainerMoleculeProtocol.swift */; }; 012A88F123985E0100FE3DA1 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88F023985E0100FE3DA1 /* Color.swift */; }; - 012CA98923849699003F810F /* SeperatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA98823849699003F810F /* SeperatorModel.swift */; }; 012CA99A2384A687003F810F /* MFTextField+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */; }; 012CA99C23859FDC003F810F /* ViewConstrainingView+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA99B23859FDC003F810F /* ViewConstrainingView+ModelExtension.swift */; }; 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */; }; @@ -278,7 +277,6 @@ 012A88EB238F084D00FE3DA1 /* FooterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterModel.swift; sourceTree = ""; }; 012A88ED239858E300FE3DA1 /* ContainerMoleculeProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerMoleculeProtocol.swift; sourceTree = ""; }; 012A88F023985E0100FE3DA1 /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = ""; }; - 012CA98823849699003F810F /* SeperatorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeperatorModel.swift; sourceTree = ""; }; 012CA9992384A687003F810F /* MFTextField+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFTextField+ModelExtension.swift"; sourceTree = ""; }; 012CA99B23859FDC003F810F /* ViewConstrainingView+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewConstrainingView+ModelExtension.swift"; sourceTree = ""; }; 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFView+ModelExtension.swift"; sourceTree = ""; }; @@ -587,8 +585,6 @@ 01EB368723609801006832FA /* Molecules */ = { isa = PBXGroup; children = ( - 012CA98823849699003F810F /* SeperatorModel.swift */, - 01EB368923609801006832FA /* ListItemModel.swift */, 011B58F323A2CCC80085F53C /* DropDownModel.swift */, 011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */, 01EB368A23609801006832FA /* MoleculeStackItemModel.swift */, @@ -719,6 +715,7 @@ children = ( D2755D7A23689C7500485468 /* TableViewCell.swift */, 01509D8E2327EC6F00EF99AA /* MoleculeTableViewCell.swift */, + 01EB368923609801006832FA /* ListItemModel.swift */, D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */, D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */, D27CD40D2322EEAF00C1DC07 /* TabsTableViewCell.swift */, @@ -1294,7 +1291,6 @@ D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */, D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */, 94C2D9A923872E5E0006CF46 /* LabelAttributeImageModel.swift in Sources */, - 012CA98923849699003F810F /* SeperatorModel.swift in Sources */, DBC4391922442197001AB423 /* DashLine.swift in Sources */, 0AA33B34239813C50067DD0F /* UIColor+Extension.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, diff --git a/MVMCoreUI/Atoms/Views/DashLineModel.swift b/MVMCoreUI/Atoms/Views/DashLineModel.swift index 79367f35..172e5dd6 100644 --- a/MVMCoreUI/Atoms/Views/DashLineModel.swift +++ b/MVMCoreUI/Atoms/Views/DashLineModel.swift @@ -9,9 +9,7 @@ import Foundation @objcMembers public class DashLineModel: MoleculeProtocol { - public static var identifier: String { - get { return "dashLine" } - } + public static var identifier: String = "dashLine" public var backgroundColor: String? public var dashColor: String diff --git a/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift b/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift index ba07fc8b..30015d70 100644 --- a/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift +++ b/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift @@ -9,11 +9,9 @@ import UIKit @objcMembers public class LeftRightLabelModel: MoleculeProtocol { + public static var identifier: String = "leftRightLabel" public var backgroundColor: String? public var leftText: LabelModel public var rightText: LabelModel - - public static var identifier: String { - get{ return "leftRightLabel" } - } + } diff --git a/MVMCoreUI/Atoms/Views/MultiProgressModel.swift b/MVMCoreUI/Atoms/Views/MultiProgressModel.swift index 62397f69..25522070 100644 --- a/MVMCoreUI/Atoms/Views/MultiProgressModel.swift +++ b/MVMCoreUI/Atoms/Views/MultiProgressModel.swift @@ -15,9 +15,7 @@ import Foundation } @objcMembers public class MultiProgressBarModel: MoleculeProtocol { - public static var identifier: String { - get{ return "multiProgressBar"} - } + public static var identifier: String = "multiProgressBar" public var moleculeName: String public var backgroundColor: String? public var progressList: [SingleProgressBarModel] diff --git a/MVMCoreUI/Atoms/Views/ProgressBarModel.swift b/MVMCoreUI/Atoms/Views/ProgressBarModel.swift index aa5912a7..3450fc87 100644 --- a/MVMCoreUI/Atoms/Views/ProgressBarModel.swift +++ b/MVMCoreUI/Atoms/Views/ProgressBarModel.swift @@ -9,9 +9,7 @@ import Foundation @objcMembers public class ProgressBarModel: MoleculeProtocol { - public static var identifier: String { - get { return "progressbar" } - } + public static var identifier: String = "progressbar" public var moleculeName: String public var isRounded: Bool? diff --git a/MVMCoreUI/Models/ModelProtocols/ListItemModelProtocol.swift b/MVMCoreUI/Models/ModelProtocols/ListItemModelProtocol.swift index ccd8884b..59e51708 100644 --- a/MVMCoreUI/Models/ModelProtocols/ListItemModelProtocol.swift +++ b/MVMCoreUI/Models/ModelProtocols/ListItemModelProtocol.swift @@ -10,5 +10,5 @@ import Foundation public protocol ListItemModelProtocol: ContainerMoleculeProtocol { var molecule: MoleculeProtocol? { get } - var separator: SeperatorModel? { get set } + var separator: LineModel? { get set } } diff --git a/MVMCoreUI/Models/Molecules/DropDownListItemModel.swift b/MVMCoreUI/Models/Molecules/DropDownListItemModel.swift index c6c109fe..7a7770df 100644 --- a/MVMCoreUI/Models/Molecules/DropDownListItemModel.swift +++ b/MVMCoreUI/Models/Molecules/DropDownListItemModel.swift @@ -12,7 +12,7 @@ import Foundation public static var identifier: String = "dropDownListItem" public var molecules: [[ListItemModel]] public var backgroundColor: String? - public var separator: SeperatorModel? + public var separator: LineModel? public var dropDown: DropDownModel public init(molecules: [[ListItemModel]], dropDown: DropDownModel) { @@ -31,7 +31,7 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) self.molecules = try typeContainer.decode([[ListItemModel]].self, forKey: .molecules) - self.separator = try typeContainer.decode(SeperatorModel.self, forKey: .separator) + self.separator = try typeContainer.decode(LineModel.self, forKey: .separator) self.backgroundColor = try typeContainer.decodeIfPresent(String.self, forKey: .backgroundColor) self.dropDown = try typeContainer.decode(DropDownModel.self, forKey: .dropDown) } diff --git a/MVMCoreUI/Models/Molecules/HeaderModel.swift b/MVMCoreUI/Models/Molecules/HeaderModel.swift index 9016184b..adbfca47 100644 --- a/MVMCoreUI/Models/Molecules/HeaderModel.swift +++ b/MVMCoreUI/Models/Molecules/HeaderModel.swift @@ -13,9 +13,9 @@ import Foundation public var moleculeName: String? public var backgroundColor: String? public var molecule: MoleculeProtocol? - public var seperator: SeperatorModel? + public var seperator: LineModel? - public init(molecule: MoleculeProtocol?, backgroundColor: String?, seperator: SeperatorModel?){ + public init(molecule: MoleculeProtocol?, backgroundColor: String?, seperator: LineModel?){ self.molecule = molecule self.backgroundColor = backgroundColor self.seperator = seperator @@ -33,7 +33,7 @@ import Foundation self.moleculeName = try typeContainer.decode(String.self, forKey: .moleculeName) self.backgroundColor = try typeContainer.decodeIfPresent(String.self, forKey: .backgroundColor) self.molecule = try typeContainer.decodeIfPresent(codingKey: .molecule) - self.seperator = try typeContainer.decodeIfPresent(SeperatorModel.self, forKey: .separator) + self.seperator = try typeContainer.decodeIfPresent(LineModel.self, forKey: .separator) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Models/Molecules/LineModel.swift b/MVMCoreUI/Models/Molecules/LineModel.swift index e00ba1fc..c6a22c62 100644 --- a/MVMCoreUI/Models/Molecules/LineModel.swift +++ b/MVMCoreUI/Models/Molecules/LineModel.swift @@ -12,8 +12,4 @@ import UIKit public static var identifier: String = "line" public var backgroundColor: String? public var type: String? - - public init(type: String?) { - self.type = type - } } diff --git a/MVMCoreUI/Models/Molecules/SeperatorModel.swift b/MVMCoreUI/Models/Molecules/SeperatorModel.swift deleted file mode 100644 index b58c7602..00000000 --- a/MVMCoreUI/Models/Molecules/SeperatorModel.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// SeperatorModel.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 11/19/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import UIKit - -@objcMembers public class SeperatorModel: MoleculeProtocol { - public static var identifier: String = "line" - public var backgroundColor: String? - public var type: String? -} diff --git a/MVMCoreUI/Models/Molecules/ListItemModel.swift b/MVMCoreUI/Molecules/Items/ListItemModel.swift similarity index 61% rename from MVMCoreUI/Models/Molecules/ListItemModel.swift rename to MVMCoreUI/Molecules/Items/ListItemModel.swift index 72556dae..5ae9e7fa 100644 --- a/MVMCoreUI/Models/Molecules/ListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/ListItemModel.swift @@ -13,19 +13,10 @@ import Foundation public var molecule: MoleculeProtocol? public var backgroundColor: String? public var action: ActionModel? - public var hideArrow: Bool? - public var separator: SeperatorModel? + public var separator: LineModel? public var style: String? - public init(molecule: MoleculeProtocol?, actionMap: ActionModel?, hideArrow: Bool?, separator: SeperatorModel?, style: String?) { - self.molecule = molecule - self.action = actionMap - self.hideArrow = hideArrow - self.separator = separator - self.style = style - } - enum CodingKeys: String, CodingKey { case moleculeName case molecule @@ -37,19 +28,20 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - self.molecule = try typeContainer.decodeIfPresent(codingKey: .molecule) + molecule = try typeContainer.decodeIfPresent(codingKey: .molecule) action = try typeContainer.decodeIfPresent(ActionModel.self, forKey: .action) - - self.hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) - self.separator = try typeContainer.decodeIfPresent(SeperatorModel.self, forKey: .separator) - self.style = try typeContainer.decodeIfPresent(String.self, forKey: .style) + hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) + separator = try typeContainer.decodeIfPresent(LineModel.self, forKey: .separator) + style = try typeContainer.decodeIfPresent(String.self, forKey: .style) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) - try container.encodeIfPresent(self.molecule, forKey: .molecule) + try container.encodeIfPresent(molecule, forKey: .molecule) try container.encodeIfPresent(action, forKey: .action) try container.encodeIfPresent(hideArrow, forKey: .hideArrow) + try container.encodeIfPresent(separator, forKey: .separator) + try container.encodeIfPresent(style, forKey: .style) } } diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 86395407..a26e2c85 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -18,7 +18,6 @@ import Foundation ModelRegistry.register(ListItemModel.self) ModelRegistry.register(TextFieldModel.self) ModelRegistry.register(LineModel.self) - ModelRegistry.register(SeperatorModel.self) ModelRegistry.register(ProgressBarModel.self) ModelRegistry.register(MultiProgressBarModel.self) ModelRegistry.register(CaretViewModel.self)