From dac871125855796ccc75266e6bd316aee7324bb6 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 25 Apr 2024 09:07:40 -0500 Subject: [PATCH] ensure molecule is removed from parent Signed-off-by: Matt Bruce --- MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift index d93c8799..7c2c13ac 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift @@ -21,7 +21,13 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{ public var delegateObject: MVMCoreUIDelegateObject? public var additionalData: [AnyHashable: Any]? - public var molecule: MoleculeViewProtocol? + public var molecule: MoleculeViewProtocol? { + willSet { + if newValue == nil { + molecule?.removeFromSuperview() + } + } + } //-------------------------------------------------- // MARK: - Initializers