TiltingLoader is a loading view you can tilt while you wait. The loader is meant to be an easy drop-in reusable UI component built in Swift that will work on iOS 7 and 8. The loader uses
UIMotionEffect to create the tilting movement.
Check out the DemoViewController for specific examples on how to use TiltingLoader
** Run on a physical device for motion effects **
Create and being animating
var tlView = TiltingLoader(frame: CGRectMake(50, 50, 100, 100), color: UIColor.purpleColor(), cornerRad: 0.0) tiltLoadingView.enableOverlayOnView(self.view) tlView.animateColors(false)
Convenience create and begin animating
TiltingLoader.showTiltingLoader(self.view, color: UIColor.orangeColor(), cornerRad: 0.0)
tlView.hide() // or to hide convenience instance TiltingLoader.hideTiltingLoader(self.view, dynamic: true)
|frame: CGRect||Simply the size of the loader within superview|
|color: UIColor||The color of the loader, darker colors work best.|
|cornerRad: CGFloat||is used to determine how rounded the corners of the loader should be.|
Before calling animateColors() on a TiltingLoader instance, you can change the following properties:
|enableOverlayOnView: UIView?||Enable overlay behind tilting loader if superview has been passed in through this method|
|animateColors: Bool||Begins color animation process by determining which color iteration method to call. When passing in false, colors animate in reverse.|
|isAnimating: Bool||Getting this value determines if a loader is currently animating. Setting this value makes it so the loader will animate when animateColors() is called. Default: true|
|animationFrequency: NSTimeInterval||The interval for how often to swap colors in the loader, causing the animation effect. Default: 0.7|
|dynamicDismissal: Bool||Determines how loader will be removed from superview. If true, loader will drop out and if false, loader will fade out. Default: false|
To install, simple drag the TiltingLoader.swift file to your project and use it.
- Use a briding header to run in an Objective-C project.
- Coming soon: CocoaPods (Adding Swift projects to CocoaPods does not currently work) Check out this CocoaPods issue for more info and progress.
TiltingLoader requires iOS 7 or later.
This project is very open to contributions using the standard process below:
- Fork this repo
- Make your changes
- Submit a pull request
TiltingLoader is distributed under the MIT license.