To run the example project, clone the repo, and run pod install
from the Example directory first.
SunnyLoadings is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SunnyLoadings'
- Instantiate the loader class
let loader = Loader(vc: self)
- To start the loading animation, call the method startAnimations, specify the position and size of your preferred loading indicator and color of choice
loader.startAnimations(x: self.view.bounds.midX, y: self.view.bounds.midY, size: self.view.bounds.width * 0.3, color: UIColor.white)
- To end the animations, just call the method stopAllAnimations with the specific case, whether it's a success:
loader.stopAllAnimations(result: .success)
or failure:loader.stopAllAnimations(result: .failure)
Known bug: When clicking the home button and returning to the app, or when changing view controllers, the expanding and shrinking animation of the circle is automatically removed. To work around this, developers can call the method removeAnimationViews: loader.removeAnimationViews()
when leaving the view and call the function 'startAnimations': loader.startAnimations(x: self.view.bounds.midX, y: self.view.bounds.midY, size: self.view.bounds.width * 0.3)
again when the view is displayed again.
ShennyO, SunnyOuyang.work@gmail.com
SunnyLoadings is available under the MIT license. See the LICENSE file for more info.