diff --git a/CHANGELOG.md b/CHANGELOG.md index badf25a6..94f0611e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 0.8.3 + +- **Fix**: `SpinnerView` animation freezing + ### 0.8.2 - **Add**: `acceptableStatusCodes` property to `NetworkServiceConfiguration` diff --git a/LeadKit.podspec b/LeadKit.podspec index 96b4d192..926ec49f 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.8.2" + s.version = "0.8.3" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" diff --git a/Sources/Classes/Views/SpinnerView/SpinnerView.swift b/Sources/Classes/Views/SpinnerView/SpinnerView.swift index 4a7b23e4..a3425184 100644 --- a/Sources/Classes/Views/SpinnerView/SpinnerView.swift +++ b/Sources/Classes/Views/SpinnerView/SpinnerView.swift @@ -24,7 +24,10 @@ import UIKit public final class SpinnerView: UIView, Animatable, LoadingIndicator { - private(set) var animating: Bool = false + private var animating: Bool { + return imageView?.layer.animation(forKey: CABasicAnimation.rotationKeyPath) != nil + } + private var startTime = CFTimeInterval(0) private var stopTime = CFTimeInterval(0) @@ -80,6 +83,14 @@ public final class SpinnerView: UIView, Animatable, LoadingIndicator { } } + override public func didMoveToSuperview() { + super.didMoveToSuperview() + + if superview != nil { + restartAnimationIfNeeded() + } + } + // MARK: - Animatable @objc public func startAnimating() { @@ -87,8 +98,6 @@ public final class SpinnerView: UIView, Animatable, LoadingIndicator { return } - animating = true - imageView?.isHidden = false addAnimation() @@ -99,8 +108,6 @@ public final class SpinnerView: UIView, Animatable, LoadingIndicator { return } - animating = false - imageView?.isHidden = true removeAnimation()