Skip to content

tfrank64/TiltingLoader

Repository files navigation

Drawing

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.

Demo

Check out the DemoViewController for specific examples on how to use TiltingLoader

Drawing

Usage

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

Hide loader

tlView.hide()
// or to hide convenience instance
TiltingLoader.hideTiltingLoader(self.view, dynamic: true)

Customization

Init Params
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:

Required Methods
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.
Configureable Properties
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

Screenshots

rectangle__ rectangle

Installation

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.

Contributing

This project is very open to contributions using the standard process below:

  • Fork this repo
  • Make your changes
  • Submit a pull request

Created By

Taylor Franklin

License

TiltingLoader is distributed under the MIT license.

About

An interactive loading view you can tilt while you wait.

Resources

License

Stars

Watchers

Forks

Packages

No packages published