Skip to content

Commit c6b4da4

Browse files
committed
Switch debugging flag to be MarqueeLabel-specific
1 parent 739f665 commit c6b4da4

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

MarqueeLabel.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "MarqueeLabel"
3-
s.version = "4.5.2"
3+
s.version = "4.5.3"
44
s.summary = "A drop-in replacement for UILabel, which automatically adds a scrolling marquee effect when needed."
55
s.homepage = "https://github.com/cbpowell/MarqueeLabel"
66
s.license = { :type => 'MIT', :file => 'LICENSE' }

Sources/MarqueeLabel.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
540540
self.init(frame: frame, duration:7.0, fadeLength:0.0)
541541
}
542542

543-
#if DEBUG
543+
#if MARQUEELABEL_DEBUG
544544
private var leadingView = UIView()
545545
private var trailingView = UIView()
546546
#endif
@@ -553,8 +553,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
553553
// View Structure
554554
self.addSubview(sublabel)
555555

556-
#if DEBUG
557-
556+
#if MARQUEELABEL_DEBUG
558557
let labelMask = UIView()
559558
labelMask.translatesAutoresizingMaskIntoConstraints = false
560559
sublabel.addSubview(labelMask)
@@ -686,7 +685,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
686685
sublabel.adjustsFontSizeToFitWidth = super.adjustsFontSizeToFitWidth
687686
sublabel.minimumScaleFactor = super.minimumScaleFactor
688687

689-
#if DEBUG
688+
#if MARQUEELABEL_DEBUG
690689
trailingView.removeFromSuperview()
691690
self.addSubview(trailingView)
692691
#endif
@@ -695,13 +694,13 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
695694
switch type {
696695
case .continuousReverse, .rightLeft:
697696
labelFrame = bounds.divided(atDistance: leadingBuffer, from: CGRectEdge.maxXEdge).remainder.integral
698-
#if DEBUG
697+
#if MARQUEELABEL_DEBUG
699698
leadingView.frame = bounds.divided(atDistance: leadingBuffer, from: CGRectEdge.maxXEdge).slice.integral
700699
trailingView.frame = bounds.divided(atDistance: trailingBuffer, from: CGRectEdge.minXEdge).slice.integral
701700
#endif
702701
default:
703702
labelFrame = CGRect(x: leadingBuffer, y: 0.0, width: bounds.size.width - leadingBuffer, height: bounds.size.height).integral
704-
#if DEBUG
703+
#if MARQUEELABEL_DEBUG
705704
leadingView.frame = CGRect(x: 0.0, y: 0.0, width: leadingBuffer, height: bounds.size.height).integral
706705
trailingView.frame = bounds.divided(atDistance: trailingBuffer, from: CGRectEdge.maxXEdge).slice.integral
707706
#endif
@@ -736,21 +735,21 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
736735

737736
switch type {
738737
case .continuous, .continuousReverse:
739-
#if DEBUG
738+
#if MARQUEELABEL_DEBUG
740739
trailingView.removeFromSuperview()
741740
sublabel.addSubview(trailingView)
742741
#endif
743742
if type == .continuous {
744743
homeLabelFrame = CGRect(x: leadingBuffer, y: 0.0, width: expectedLabelSize.width, height: bounds.size.height).integral
745744
awayOffset = -(homeLabelFrame.size.width + minTrailing)
746-
#if DEBUG
745+
#if MARQUEELABEL_DEBUG
747746
leadingView.frame = CGRect(x: 0.0, y: 0.0, width: leadingBuffer, height: bounds.size.height)
748747
trailingView.frame = CGRect(x: -awayOffset - minTrailing, y: 0.0, width: trailingBuffer, height: bounds.size.height)
749748
#endif
750749
} else { // .ContinuousReverse
751750
homeLabelFrame = CGRect(x: bounds.size.width - (expectedLabelSize.width + leadingBuffer), y: 0.0, width: expectedLabelSize.width, height: bounds.size.height).integral
752751
awayOffset = (homeLabelFrame.size.width + minTrailing)
753-
#if DEBUG
752+
#if MARQUEELABEL_DEBUG
754753
leadingView.frame = bounds.divided(atDistance: leadingBuffer, from: CGRectEdge.maxXEdge).slice.integral
755754
trailingView.frame = CGRect(x: -trailingBuffer, y: 0.0, width: trailingBuffer, height: bounds.size.height)
756755
#endif
@@ -785,7 +784,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
785784
repliLayer?.instanceTransform = CATransform3DMakeTranslation(-awayOffset, 0.0, 0.0)
786785

787786
case .leftRight, .left, .rightLeft, .right:
788-
#if DEBUG
787+
#if MARQUEELABEL_DEBUG
789788
trailingView.removeFromSuperview()
790789
self.addSubview(trailingView)
791790
#endif
@@ -794,7 +793,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
794793
awayOffset = bounds.size.width - (expectedLabelSize.width + leadingBuffer + trailingBuffer)
795794
// Enforce text alignment for this type
796795
sublabel.textAlignment = NSTextAlignment.left
797-
#if DEBUG
796+
#if MARQUEELABEL_DEBUG
798797
leadingView.frame = CGRect(x: 0.0, y: 0.0, width: leadingBuffer, height: bounds.size.height)
799798
trailingView.frame = bounds.divided(atDistance: trailingBuffer, from: CGRectEdge.maxXEdge).slice.integral
800799
#endif
@@ -803,7 +802,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
803802
awayOffset = (expectedLabelSize.width + trailingBuffer + leadingBuffer) - bounds.size.width
804803
// Enforce text alignment for this type
805804
sublabel.textAlignment = NSTextAlignment.right
806-
#if DEBUG
805+
#if MARQUEELABEL_DEBUG
807806
leadingView.frame = bounds.divided(atDistance: leadingBuffer, from: CGRectEdge.maxXEdge).slice.integral
808807
trailingView.frame = CGRect(x: 0.0, y: 0.0, width: trailingBuffer, height: bounds.height)
809808
#endif

0 commit comments

Comments
 (0)