[ad_1]
I’m making an attempt to load a Lottie animation within the subview of scrollview.refreshControl, the animation seems on the pull to refresh however is glitching which makes the animation look not easy and seems to be very buggy.
the code that I’m utilizing in viewDidLoad:
let loadingView : AnimationView = {
let view = AnimationView()
view.translatesAutoresizingMaskIntoConstraints = false
view.animation = Animation.named("loading-dots-blue")
view.loopMode = .loop
view.contentMode = .scaleAspectFill
view.play()
return view
}()
scrollView.refreshControl = UIRefreshControl()
scrollView.refreshControl?.addTarget(self, motion: #selector(self.refresh(_:)), for: .valueChanged)
scrollView.refreshControl!.addSubview(loadingView)
scrollView.refreshControl?.tintColor = .clear
loadingView.centerXAnchor.constraint(equalTo: scrollView.refreshControl!.centerXAnchor).isActive = true
loadingView.centerYAnchor.constraint(equalTo: scrollView.refreshControl!.centerYAnchor).isActive = true
loadingView.widthAnchor.constraint(equalToConstant: UIScreen.primary.bounds.width/2).isActive = true
loadingView.heightAnchor.constraint(equalToConstant: 50).isActive = true
This solely happens on lottie animation, the default activityIndicator seems to be animating easily.
[ad_2]

