From 870292f50205f5bd195c26c9af05bad4f8269aa6 Mon Sep 17 00:00:00 2001 From: Dmytro Genyk Date: Mon, 5 Aug 2019 15:35:50 +0300 Subject: [PATCH 1/2] added configurable expand animation duration --- Classes/ExpandableLabel.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/ExpandableLabel.swift b/Classes/ExpandableLabel.swift index b02213f..f524750 100644 --- a/Classes/ExpandableLabel.swift +++ b/Classes/ExpandableLabel.swift @@ -49,13 +49,15 @@ open class ExpandableLabel: UILabel { /// The delegate of ExpandableLabel weak open var delegate: ExpandableLabelDelegate? + open var animationDuration: Double = 0.5 + /// Set 'true' if the label should be collapsed or 'false' for expanded. @IBInspectable open var collapsed: Bool = true { didSet { super.attributedText = (collapsed) ? self.collapsedText : self.expandedText super.numberOfLines = (collapsed) ? self.collapsedNumberOfLines : 0 if let animationView = animationView { - UIView.animate(withDuration: 0.5) { + UIView.animate(withDuration: self.animationDuration) { animationView.layoutIfNeeded() } } From 222ef11e63ce9668d69315effbec2f17590364a5 Mon Sep 17 00:00:00 2001 From: Dmytro Genyk <53038561+dgenyk-techmagic@users.noreply.github.com> Date: Mon, 5 Aug 2019 16:09:03 +0300 Subject: [PATCH 2/2] Update ExpandableLabel.swift fixed description lines --- Classes/ExpandableLabel.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/ExpandableLabel.swift b/Classes/ExpandableLabel.swift index 315c035..e839088 100644 --- a/Classes/ExpandableLabel.swift +++ b/Classes/ExpandableLabel.swift @@ -45,10 +45,11 @@ import UIKit } /// The delegate of ExpandableLabel - - open var animationDuration: Double = 0.5 @objc weak open var delegate: ExpandableLabelDelegate? + /// Animation duration for expanding/collapsing + open var animationDuration: Double = 0.5 + /// Set 'true' if the label should be collapsed or 'false' for expanded. @IBInspectable open var collapsed: Bool = true { didSet {