I want to creat a simple circular loader animation circle and border around it which is disappearing
I found great frameworks but they use SKShapeNode and SKShapeNode performance is terrible for actual deployed app
I want to creat a simple circular loader animation circle and border around it which is disappearing
I found great frameworks but they use SKShapeNode and SKShapeNode performance is terrible for actual deployed app
You could use a UIView within a UIImageView with a "loading circle" as image and just let rotate it. Here is a example class:
import UIKit
class CircularLoadingView: UIView {
@IBOutlet weak var rotatingImage: UIImageView!
let duration: Double = 1
func startAnimation() {
let animation = CABasicAnimation(keyPath: "transform.rotation.z")
animation.toValue = NSNumber(floatLiteral: M_PI * 2.0 * duration)
animation.duration = duration
animation.isCumulative = true
animation.repeatCount = Float(CGFloat.greatestFiniteMagnitude)
rotatingImage.layer.add(animation, forKey: "animationKey")
UIView.animate(withDuration: duration, animations: {
self.alpha = 1
})
}
}
Just add a UIView and set CircularLoadingView as custom class. Add a UIImageView, set the image you want to rotate, set the outlets and constraints and see what happens.
But with this attempt you need an image, which you have to create or to find.
If this does not help you, perhaps this old raywenderlich tutorial can. There they show how to make a circular indicator with CAShapeLayer.