NVActivityIndicatorView is a collection of nice loading animations.
This is original a fork from DGActivityIndicatorView, inspired by Loaders.css, written in Swift with full implementation of animations.
You can also find Objective-C version of this here.
For first-hand experience, just open the project and run it.
- BallPulse
- BallGridPulse
- BallClipRotate
- SquareSpin
- BallClipRotatePulse
- BallClipRotateMultiple
- BallPulseRise
- BallRotate
- CubeTransition
- BallZigZag
- BallZigZagDeflect
- BallTrianglePath
- BallScale
- LineScale
- LineScaleParty
- BallScaleMultiple
- BallPulseSync
- BallBeat
- LineScalePulseOut
- LineScalePulseOutRapid
- BallScaleRipple
- BallScaleRippleMultiple
- BallSpinFadeLoader
- LineSpinFadeLoader
- TriangleSkewSpin
- Pacman
- BallGridBeat
- SemiCircleSpin
- BallRotateChase
Install Cocoapods if need be
$ gem install cocoapods
Add NVActivityIndicatorView in your Podfile
use_frameworks!
pod 'NVActivityIndicatorView'
Then, run the following command
$ pod install
Install Carthage if need be
$ brew update
$ brew install carthage
Add NVActivityIndicatorView in your Cartfile
github "ninjaprox/NVActivityIndicatorView"
Run carthage
to build the framework and drag the built NVActivityIndicatorView.framework
into your Xcode project.
Copy NVActivityIndicatorView folder to your project. That's it.
Firstly, import NVActivityIndicatorView
import NVActivityIndicatorView
Then, there are multiple ways you can create NVActivityIndicatorView:
-
Use it in storyboard by changing class of any
UIView
toNVActivityIndicatorView
This will use default values white, .Pacman, 0 for color, type and padding respectively. -
Create with specified type, color and padding
NVActivityIndicatorView(frame: frame, type: type, color: color, padding: padding)
Any of the last three arguments can be omitted. If an argument is omitted it will use the default values which are white, .Pacman, 0 for color, type and padding respectively. Therefore, you can also create NVActivityIndicatorView using any of the following:
- Specify only frame, type and color
NVActivityIndicatorView(frame: frame, type: type, color: color)
- Specify only frame, type and padding
NVActivityIndicatorView(frame: frame, type: type, padding: padding)
- Specify only frame, color and padding
NVActivityIndicatorView(frame: frame, color: color, padding: padding)
- Specify only frame and type
NVActivityIndicatorView(frame: frame, type: type)
- Specify only frame and color
NVActivityIndicatorView(frame: frame, color: color)
- Specify only frame and padding
NVActivityIndicatorView(frame: frame, padding: padding)
- Specify only frame
NVActivityIndicatorView(frame: frame)
Start animation
activityIndicatorView.startAnimation()
Stop animation
activityIndicatorView.stopAnimation()
If you use NVActivityIndicatorView
in storyboard, you can change these properties in Attributes inspector tab of Utilities panel.
Use one of values (case-insensitive) in Animation types for Type Name
.
Specify individual properties after initialization:
- Specify type
activityIndicatorView.type = .LineScale
- Specify color
activityIndicatorView.color = UIColor.redColor()
Specify whether activity indicator view should hide once stopped
activityIndicatorView.hidesWhenStopped = true
Get current status of animation
animation = activityIndicatorView.animating
Thanks Connor Atherton for great loaders and Danil Gontovnik for kick-start.
The MIT License (MIT)
Copyright (c) 2015 Nguyen Vinh @ninjaprox