Giter VIP home page Giter VIP logo

hexloader's Introduction

HexLoader

[![CI Status](http://img.shields.io/travis/Kesavasankar Jawaharlal/HexLoader.svg?style=flat)](https://travis-ci.org/Kesavasankar Jawaharlal/HexLoader) Version License Platform

This is a open source library which shows a hexagon shaped loading indictor, developed CAShapeLayer and CABasicAnimation. The library is highly customisable.

Demo

Try HexLoader on Appetize.io.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Screenshots

Dark Background with Loading Text Light Background without Loading Text and no inner offset
Transparent Background Dark Background without backdrop
Transparent Background with custom Loading Text Color

Requirements

Installation

HexLoader is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "HexLoader"

Manual Installation

Just copy the files under 'HexLoader/Classes' folder to get going.

Usage

The library has a protocol extension named 'LoadingViewPresentable', which enables any view controller to call the library easily without any boiler plate code. To start the loader, all you need to call any of the below two public functions, which were part of the protocol extension, from any of your UIViewControllers.

startLoading()

or call the below function to have some text beneath the indicator.

startLoading(with: "Loading...")

The indicator can be stopped by calling the below function

stopLoading()

Configuration

The loader has an extensive list of customisations exposed through a Singleton class 'HexLoaderConfig'. Below are the params available

/**
 *  Length of each side
 */
HexagonLoaderConfig.shared.hexagonSideLength = 60

/**
 *  Inner offset for each Hexagon
 */
HexagonLoaderConfig.shared.hexagonInnerOffset = 2

/**
 *  Color of Hexagon
 */
HexagonLoaderConfig.shared.hexagonBackgroundColor = .white

/**
 *  Color of Hexagon border
 */
HexagonLoaderConfig.shared.hexagonBorderColor = white
	
/**
 *  Background Type
 */
HexagonLoaderConfig.shared.backgroundType = .transparent

/**
* Boolean to indicate if a backdrop over lay is needed to be displayed
*/
HexagonLoaderConfig.shared.displayBackdropOverlay = true

/**
 *  Backdrop Overlay Color. This will be used only if'displayBackdropOverlay' var is set to true
 */
HexagonLoaderConfig.shared.backdropOverlayColor = #colorLiteral(red: 0.4156862745, green: 0.7176470588, blue: 0.968627451, alpha: 1)

/**
 *  Backdrop Overlay Corner Radius. This will be used only if'displayBackdropOverlay' var is set to true
 */
HexagonLoaderConfig.shared.backdropOverlayCornerRadius = 10

/**
* Loading Text Font
*/
HexagonLoaderConfig.shared.loadingTextFont = UIFont.systemFont(ofSize: 17)

/**
 * Loading Text Color
 */
HexagonLoaderConfig.shared.loadingTextColor = .white

/**
 *  Animation Speed of the loader
 */
HexagonLoaderConfig.shared.animationSpeed = 1

Author

Kesava Jawaharlal, [email protected]

License

HexLoader is available under the MIT license. See the LICENSE file for more info.

hexloader's People

Contributors

kesava-jawaharlal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.