From 0f9a48a3ec02fa359fde083a2dc06443c446ea23 Mon Sep 17 00:00:00 2001 From: Joe Jiang Date: Fri, 21 May 2021 14:01:10 +0800 Subject: [PATCH] fix: Animation would stop when scrolling --- WaveAnimationView/WaveAnimationView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/WaveAnimationView/WaveAnimationView.swift b/WaveAnimationView/WaveAnimationView.swift index be0becc..428601e 100644 --- a/WaveAnimationView/WaveAnimationView.swift +++ b/WaveAnimationView/WaveAnimationView.swift @@ -96,6 +96,7 @@ public class WaveAnimationView: UIView { //Start wave Animation open func startAnimation() { timer = Timer.scheduledTimer(timeInterval: 0.035, target: self, selector: #selector(waveAnimation), userInfo: nil, repeats: true) + RunLoop.main.add(timer, forMode: .common) } //MARK: Please be sure to call this method at ViewDidDisAppear or deinit in ViewController.