From 8f3bf61574393bef0e8f9ccb9a658136039e9c22 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Thu, 22 Feb 2024 17:39:36 -0500 Subject: [PATCH] Gone changes for the list item --- MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift | 3 ++- .../Protocols/ModelProtocols/ListItemModelProtocol.swift | 1 + MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift index 6413a381..6dbe79ae 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift @@ -6,7 +6,7 @@ // Copyright © 2020 Verizon Wireless. All rights reserved. // // A base class that has common list item boilerplate model stuffs. - +import MVMCore @objcMembers open class ListItemModel: ContainerModel, ListItemModelProtocol { //-------------------------------------------------- @@ -18,6 +18,7 @@ public var hideArrow: Bool? public var line: LineModel? public var style: ListItemStyle? + @DecodableDefault.False public var gone: Bool public var accessibilityTraits: UIAccessibilityTraits? public var accessibilityValue: String? public var accessibilityText: String? diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift index b3b7be7e..74d6e3fe 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift @@ -20,6 +20,7 @@ public protocol ListItemModelProtocol: ContainerModelProtocol, AccessibilityMode var action: ActionModelProtocol? { get set } var hideArrow: Bool? { get set } var style: ListItemStyle? { get set } + var gone: Bool { get set } } // Not a strict requirement. diff --git a/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift index 9c9f4896..3ee75be1 100644 --- a/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift @@ -135,6 +135,10 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol } } + public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return (getMoleculeInfo(for: indexPath)?.molecule as? ListItemModelProtocol)?.gone == true ? 0 : UITableView.automaticDimension + } + open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { guard let moleculeInfo = getMoleculeInfo(for: indexPath), let estimatedHeight = (moleculeInfo.class as? MoleculeViewProtocol.Type)?.estimatedHeight(with: moleculeInfo.molecule, delegateObject() as? MVMCoreUIDelegateObject)