From c9589e9b94c06cce2735cfa9e186b8f8f65dddfe Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 24 Apr 2024 17:15:11 -0500 Subject: [PATCH] added nameforReuse Signed-off-by: Matt Bruce --- MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift index 4737c2db..941e9b3e 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift @@ -97,6 +97,16 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{ public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { 100 } + + /// Allows the molecule to set its name for reuse. Default could be moleculeName. Mainly used for list or collections. + public static func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { + // This will aggregate names of molecules to make an id. + guard let model = model as? ButtonGroupModel else { + return "tileContainer<>" + } + return "tileContainer<\(model.moleculeName)>" + } + //-------------------------------------------------- // MARK: - Overrides