From ce8b5b85cb841d0e20a86084d4d89bded015cf28 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 25 Apr 2024 14:56:00 -0500 Subject: [PATCH 1/2] sync properties also ensured same properties were in Signed-off-by: Matt Bruce --- .../Atomic/Atoms/Views/TileContainer.swift | 23 +++++--- .../Atoms/Views/TileContainerModel.swift | 28 +++++++--- MVMCoreUI/Atomic/Atoms/Views/Tilelet.swift | 56 +++++++++++++++---- 3 files changed, 79 insertions(+), 28 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift index 57b8b8f2..e00c2784 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift @@ -51,19 +51,12 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{ } } + // set backgroundImage if let imageName = viewModel.backgroundImage { loadImage(imageName) } - padding = viewModel.padding - color = viewModel.color - backgroundEffect = viewModel.backgroundEffect - aspectRatio = viewModel.aspectRatio - width = viewModel.width - height = viewModel.height - showBorder = viewModel.showBorder - showDropShadows = viewModel.showDropShadwows - //setup action + //set action if let action = viewModel.action { //add the subscriber onClick = { [weak self] control in @@ -74,6 +67,18 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{ delegateObject: self.delegateObject) } } + + //set the rest of the properties + surface = viewModel.surface + imageFallbackColor = viewModel.imageFallbackColor + width = viewModel.width + height = viewModel.height + showBorder = viewModel.showBorder + showDropShadow = viewModel.showDropShadow + padding = viewModel.padding + color = viewModel.color + aspectRatio = viewModel.aspectRatio + backgroundEffect = viewModel.backgroundEffect } private func loadImage(_ imageName: String? = nil) { diff --git a/MVMCoreUI/Atomic/Atoms/Views/TileContainerModel.swift b/MVMCoreUI/Atomic/Atoms/Views/TileContainerModel.swift index b6932ef9..895bb027 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/TileContainerModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/TileContainerModel.swift @@ -55,37 +55,44 @@ open class TileContainerBaseModel Date: Thu, 25 Apr 2024 15:14:55 -0500 Subject: [PATCH 2/2] forgot to add the action Signed-off-by: Matt Bruce --- MVMCoreUI/Atomic/Atoms/Views/ButtonIcon.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MVMCoreUI/Atomic/Atoms/Views/ButtonIcon.swift b/MVMCoreUI/Atomic/Atoms/Views/ButtonIcon.swift index 389033cb..89237662 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/ButtonIcon.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ButtonIcon.swift @@ -27,6 +27,14 @@ open class ButtonIcon: VDS.ButtonIcon, VDSMoleculeViewProtocol { public func viewModelDidUpdate() { surface = viewModel.surface + onClick = { [weak self] control in + guard let self, let viewModel = self.viewModel else { return } + MVMCoreUIActionHandler.performActionUnstructured(with: viewModel.action, + sourceModel: viewModel, + additionalData: self.additionalData, + delegateObject: self.delegateObject) + } + badgeIndicatorModel = viewModel.badgeIndicatorModel kind = viewModel.kind surfaceType = viewModel.surfaceType