The code is still here and you can still clone it, however the library will not receive any more updates or support.
Present loading indicators anywhere quickly and easily
A helpful loading spinner tool allowing you to present a UIActivityIndicator view directly in to views and buttons.
- iOS 9.0+
- Swift 4.0+
(Swift 2.2 & Swift 2.3 & Swift 3 supported in older versions)
github "nodes-ios/Spinner" ~> 2.0
pod 'NSpinner', '~> 1.2.4'
Last versions compatible with lower Swift versions:
Swift 3
github "nodes-ios/Spinner" ~> 1.2
Swift 2.3
github "nodes-ios/Spinner" == 0.2.5
Swift 2.2
github "nodes-ios/Spinner" == 0.2.4
Easily present spinners in views like so:
let spinner = SpinnerView.showSpinner(inView: view)
Spinner also gives you the option to customise the UIActivityIndicator Style, color and whether it should disable user interaction of the passed view. These optional parameters will be set as the following if not set.
public static func showSpinner(inView view: UIView, style: UIActivityIndicatorViewStyle = .white, color:UIColor? = nil, disablesUserInteraction: Bool = true, dimBackground: Bool = false) -> SpinnerView
Example of adding it to a view.
let spinner = SpinnerView.showSpinner(inView: view, style: UIActivityIndicatorViewStyle.white, color: UIColor.red, disablesUserInteraction: false, dimBackground: true)
To remove the spinner from your view simply call dismiss.
spinner.dismiss()
If you would rather use something more custom than the UIActivityIndicator, you can set an array of images to the Spinner with a duration time it takes to animate through them and display it in a view.
public static func set(customImages images: [UIImage], duration: TimeInterval)
public static func showCustomSpinner(inView view: UIView, dimBackground: Bool = false) -> SpinnerView
You can also display the spinner in buttons, simply add the spinner to any UIButton and the spinner will hide the title in the button and display the spinner in the centre of the button. Once the spinner is dismissed, the title will be made visible once more.
public static func showCustomSpinner(inButton button: UIButton, disablesUserInteraction:Bool = true) -> SpinnerView
Made with ❤️ at Nodes.
Spinner is available under the MIT license. See the LICENSE file for more info.