An iOS material design spinner view.
With CocoaPods, add this line to your Podfile.
pod 'JTMaterialSpinner', '~> 2.0'
import UIKit
import JTMaterialSpinner
class ViewController: UIViewController {
var spinnerView = JTMaterialSpinner()
override func viewDidLoad() {
super.viewDidLoad()
// Customize the line width
spinnerView.circleLayer.lineWidth = 2.0
// Change the color of the line
spinnerView.circleLayer.strokeColor = UIColor.orange.cgColor
// Change the duration of the animation
spinnerView.animationDuration = 2.5
}
func loadSomething () {
spinnerView.beginRefreshing()
MyService.loadSomeData() { () -> () in
spinnerView.endRefreshing()
}
}
}
- iOS 8.0 or higher
- Swift 3.0
JTMaterialSpinner is released under the MIT license. See the LICENSE file for more info.