diff --git a/MVMCoreUI/Atomic/Atoms/Views/Wheel.swift b/MVMCoreUI/Atomic/Atoms/Views/Wheel.swift index da71ea0f..d81af71c 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Wheel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Wheel.swift @@ -11,7 +11,7 @@ import UIKit @objcMembers open class Wheel: View, MVMCoreUIViewConstrainingProtocol { var heightConstraint: NSLayoutConstraint? - var gradientLayer: CALayer? + weak var gradientLayer: CALayer? var graphModel: WheelModel? { return model as? WheelModel } @@ -170,20 +170,9 @@ import UIKit rotation.timingFunction = CAMediaTimingFunction(name: .linear) rotation.fillMode = .both rotation.isRemovedOnCompletion = false + rotation.repeatCount = Float.greatestFiniteMagnitude - //avoid infinity animation take high CPU momery usage when layer is not displayed - rotation.delegate = self - rotation.repeatCount = 1 self.gradientLayer?.add(rotation, forKey: "rotation") }) } } - - -extension Wheel: CAAnimationDelegate { - public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) { - if let object = graphModel { - rotationAnimation(object) - } - } -}