From 25058dd92de108c46d141e135b866d2dd4716834 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 1 Mar 2024 12:41:13 +0530 Subject: [PATCH 1/3] self.isVisibleOnScreen for isActive --- VDS/Components/Loader/Loader.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDS/Components/Loader/Loader.swift b/VDS/Components/Loader/Loader.swift index baf6ecdb..3b4c8ebd 100644 --- a/VDS/Components/Loader/Loader.swift +++ b/VDS/Components/Loader/Loader.swift @@ -80,7 +80,7 @@ open class Loader: View { super.updateView() icon.color = iconColorConfiguration.getColor(self) icon.customSize = size - if isActive { + if isActive, self.isVisibleOnScreen { startAnimating() } else { stopAnimating() From 6e8fe4ea91625d847489cadfe477eb00e1fabcbf Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 1 Mar 2024 09:14:13 -0600 Subject: [PATCH 2/3] use && instead of comma (,) if you don't use if let Signed-off-by: Matt Bruce --- VDS/Components/Loader/Loader.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDS/Components/Loader/Loader.swift b/VDS/Components/Loader/Loader.swift index 3b4c8ebd..1cfb02c4 100644 --- a/VDS/Components/Loader/Loader.swift +++ b/VDS/Components/Loader/Loader.swift @@ -80,7 +80,7 @@ open class Loader: View { super.updateView() icon.color = iconColorConfiguration.getColor(self) icon.customSize = size - if isActive, self.isVisibleOnScreen { + if isActive && isVisibleOnScreen { startAnimating() } else { stopAnimating() From 1cce53922283de8dec505b47b6d14941028d88d1 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 1 Mar 2024 10:14:05 -0600 Subject: [PATCH 3/3] added layoutsubviews to call setNeedsUpdate Signed-off-by: Matt Bruce --- VDS/BaseClasses/Control.swift | 4 ++++ VDS/BaseClasses/View.swift | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/VDS/BaseClasses/Control.swift b/VDS/BaseClasses/Control.swift index e4ba8cde..cc2246aa 100644 --- a/VDS/BaseClasses/Control.swift +++ b/VDS/BaseClasses/Control.swift @@ -132,4 +132,8 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { return true } + open override func layoutSubviews() { + super.layoutSubviews() + setNeedsUpdate() + } } diff --git a/VDS/BaseClasses/View.swift b/VDS/BaseClasses/View.swift index 89e5ce4b..a807c25c 100644 --- a/VDS/BaseClasses/View.swift +++ b/VDS/BaseClasses/View.swift @@ -86,4 +86,9 @@ open class View: UIView, ViewProtocol, UserInfoable { isEnabled = true } + open override func layoutSubviews() { + super.layoutSubviews() + setNeedsUpdate() + } + }