Skip to content
Makes using UIActivityIndicatorView even easier.
Swift Objective-C Ruby
Branch: master
Clone or download
Latest commit 8be5186 Oct 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources/Spinner SPM support added Jun 25, 2019
Spinner-tvOS Add tvOS target Oct 3, 2016
Spinner-tvOSTests
Spinner.xcodeproj fixing failing tests Apr 11, 2019
Spinner adds potential button image again after spinner is dismissed Apr 11, 2019
SpinnerDemo/SpinnerDemo adds potential button image again after spinner is dismissed Apr 11, 2019
SpinnerTests fixing failing tests Apr 11, 2019
.gitignore adds autoresizing mask to ImageView Oct 3, 2017
.travis.yml upgrades Spinner framework, tests and demo to Swift 4.2 Mar 28, 2019
LICENSE Initial commit Jan 26, 2016
Package.swift SPM support added Jun 25, 2019
README.md Update README Oct 13, 2019
Spinner.podspec Update podspec author field Oct 14, 2019
codecov.yml add codecov.yml Oct 13, 2016

README.md

Spinner

Present loading indicators anywhere quickly and easily

Travis Codecov Carthage Compatible Plaform GitHub license

A helpful loading spinner tool allowing you to present a UIActivityIndicator view directly in to views and buttons.

📝 Requirements

  • iOS 9.0+
  • Swift 4.0+
    (Swift 2.2 & Swift 2.3 & Swift 3 supported in older versions)

📦 Installation

Carthage

github "nodes-ios/Spinner" ~> 2.0

Cocoapods

pod 'Spinner', '~> 1.2.3'

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

💻 Usage

Standard spinner

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()

Custom spinner

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

Buttons

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

Credits

Made with ❤️ at Nodes.

📄 License

Spinner is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.