From 112d8b0cbfef2b7548ecdaa0e6b00bf98692817b Mon Sep 17 00:00:00 2001 From: Charles Powell Date: Tue, 20 Jul 2021 20:38:28 -0700 Subject: [PATCH] Add forceScrolling change logic --- Sources/MarqueeLabel.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/MarqueeLabel.swift b/Sources/MarqueeLabel.swift index 6a7268d..6598416 100644 --- a/Sources/MarqueeLabel.swift +++ b/Sources/MarqueeLabel.swift @@ -153,7 +153,6 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate { } } - @IBInspectable public var forceScrolling: Bool = false /** A boolean property that sets whether the `MarqueeLabel` should scroll, even if the specificed test string can be fully contained within the label frame. @@ -169,6 +168,15 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate { - SeeAlso: holdScrolling - SeeAlso: tapToScroll */ + @IBInspectable public var forceScrolling: Bool = false { + didSet { + if forceScrolling != oldValue { + if !(awayFromHome || holdScrolling || tapToScroll ) && labelShouldScroll() { + updateAndScroll() + } + } + } + } /** A boolean property that sets whether the `MarqueeLabel` should only begin a scroll when tapped.