PKLoader
A Swift based helper class that will provide the loader for your application, on a view or on the window.
Requirements
- iOS 10.0+
- Xcode 9.4
Installation
For manual instalation, drag Source folder into your project.
or use CocoaPod adding this line to you Podfile
:
pod 'PKLoader'
Usage
For Start Loading
- Just call
startAnimating()
method withshared
instance ofPKLoader
Example:
//If you want to show the loader on window/full screen, Use:
PKLoader.shared.startAnimating()
//If you want to convert any UIView, UIButton, UILabel etc. in to loader, Use:
PKLoader.shared.startAnimating(onView: <instance_of_your_view>)
For Stop Loading
- Just call
stopAnimating()
method withshared
instance ofPKLoader
Example:
PKLoader.shared.stopAnimating()
Configuration To Chnage Animation
To change the default configuration of the loader just change the values of PKLoaderSettings
, Like:
Important Property:
indicatorType
used to decide the loader animation type. Default:PKLoader.IndicatorType.ballRotateChase
Properties Only Useful in Case of Full Screen Loader
-
backgroundSize
used to give the size for the background view. Default:CGSize(width: 100.0, height: 100.0)
-
backgroundColor
used to give the background color for the background view. Default:UIColor.white
-
cornerRadius
used to give the corner radius for the background view. Default:10.0
-
indicatorSize
used to give the default size for the indicator animation. Default:CGSize(width: 20.0, height: 20.0)
-
indicatorColor
used to give the color for the indicator animation. Default:UIColor.gray
Properties Useful in Both Case
-
indicatorPadding
used to give the padding for the indicator animation. Default:UIEdgeInsets(top: 5.0, left: 5.0, bottom: 5.0, right: 5.0)
-
shouldMakeRound
decides weather make the passed view circular or not. Default:true
Licence
PKLoader is released under the MIT license.