Coder Social home page Coder Social logo

maxprig / rappleprogresshud Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rjeprasad/rappleprogresshud

0.0 2.0 0.0 14.06 MB

Swift based universal progress indicator (Swift 3)

License: MIT License

Shell 17.14% Ruby 1.30% Objective-C 1.68% Swift 79.88%

rappleprogresshud's Introduction

RappleProgressHUD

Version License Platform

###Demo demo

##Requirements

  • Swift 3
  • Xcode 8
  • iOS 8+

Installation

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

Usage

pod "RappleProgressHUD" 

Then simply import RappleProgressHUD

import RappleProgressHUD

RappleActivityIndicatorView can be started using any of the starter methods mentioned below. When calling these starter methods, two basic input values are required to customize UIs.

label

this is the text value we are gonna display with the animated indicator

attributes

this is a dictionary with following Keys.

  • RappleTintColorKey Color of the progress circle and text
  • RappleScreenBGColorKey Background color (full screen background)
  • RappleProgressBGColorKey Background color around the progress indicator (Only applicable for Apple Style)
  • RappleIndicatorStyleKey Style of the ActivityIndicator - see below section for styles
  • RappleProgressBarColorKey Progress bar bg color - track bg color
  • RappleProgressBarFillColorKey Progress bar filling color with progression - filled track color

In above dictionary we can send 'RappleIndicatorStyleKey' with two styles (see the demo for more details)

  • RappleStyleApple Default Apple ActivityIndicator
  • RappleStyleCircle Custom Circular ActivityIndicator
  • RappleStyleText Custom Texual ActivityIndicator (e.g. Loading.. | Loading....)

RappleActivityIndicatorView has two pre-defines attribute sets for ease of use

RappleAppleAttributes Predefined attribute dictionary to match default apple look & feel

  • RappleTintColorKey white
  • RappleScreenBGColorKey white: 0.0, alpha: 0.2
  • RappleProgressBGColorKey white: 0.0, alpha: 0.7
  • RappleIndicatorStyleKey RappleStyleApple
  • RappleProgressBarColorKey lightGray
  • RappleProgressBarFillColorKey white

RappleModernAttributes Predefined attribute dictionary with modern look & feel

  • RappleTintColorKey white
  • RappleScreenBGColorKey white: 0.0, alpha: 0.5
  • RappleProgressBGColorKey N/A
  • RappleIndicatorStyleKey RappleStyleCircle
  • RappleProgressBarColorKey lightGray
  • RappleProgressBarFillColorKey white

RappleTextAttributes Predefined attribute dictionary with modern look & feel

  • RappleTintColorKey white
  • RappleScreenBGColorKey white: 0.0, alpha: 0.5
  • RappleProgressBGColorKey N/A
  • RappleIndicatorStyleKey RappleStyleText
  • RappleProgressBarColorKey N/A
  • RappleProgressBarFillColorKey N/A

Or we can send any custom made dictionary with these Key values to customize the look and feel

to create custom attribute dictionary we can use below method

let attributes = RappleActivityIndicatorView.attribute(style: RappleStyleCircle, tintColor: .white, screenBG: nil, progressBG: .black, progressBarBG: .lightGray, progreeBarFill: .yellow)

RappleActivityIndicatorView starter methods

Start RappleActivityIndicatorView using RappleModernAttributes - no text message

RappleActivityIndicatorView.startAnimating()

Start RappleActivityIndicatorView with custom (or pre-defined) attributes - no text message

RappleActivityIndicatorView.startAnimating(attributes: RappleModernAttributes)

Start RappleActivityIndicatorView with a text message, using RappleModernAttributes

RappleActivityIndicatorView.startAnimatingWithLabel("Processing...")

Start RappleActivityIndicatorView with text message and attributes

RappleActivityIndicatorView.startAnimatingWithLabel("Processing...", attributes: RappleModernAttributes)

Stop RappleActivityIndicatorView

RappleActivityIndicatorView.stopAnimating()

RappleActivityIndicatorView can also be closed with completion indicator

RappleActivityIndicatorView.stopAnimation(completionIndicator: .success, completionLabel: "Completed.", completionTimeout: 1.0)

We can use any of the following RappleCompletion enum values as the indicator

  • none Stop and hide animation with out completion indicator
  • success ✓ symbol
  • failed ✕ symbol
  • incomplete ! symbol
  • unknown ? symbol

Start RappleActivityIndicatorView’s progress value

  • progress amount 0<= progress <= 1.0
  • textual progress amount value (e.g. "3/8" or "3/10") : limited space available
  • textValue nil will display percentage values (e.g. 78%)
  • textValue ""-> hide textual progress amount
  • RappleStyleApple will use default apple progress bar
  • RappleStyleCircle will use circular progress bar
  • RappleStyleText will not display any progress bar
RappleActivityIndicatorView.setProgress(0.2, textValue: "1/5")
RappleActivityIndicatorView.setProgress(0.2) // Display with percentage value

How to add progress bar

First start progress bar using any of the starter methods
Then call setProgress methods with or without textValue: parameter

RappleActivityIndicatorView.startAnimatingWithLabel("Processing...")
RappleActivityIndicatorView.setProgress(0.2, textValue: "1/5")

Then gradually increase progress values accordingly - can be called from any thread

RappleActivityIndicatorView.setProgress(0.4, textValue: "2/5")

Check for RappleActivityIndicatorView visiblility

RappleActivityIndicatorView.isVisible()

Example Project

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

Check CocoaPodTester project for more

Author

Rajeev Prasad, [email protected]

License

The MIT License (MIT)

Copyright (c) 2017 Rajeev Prasad [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

rappleprogresshud's People

Contributors

rjeprasad avatar amitaib avatar

Watchers

James Cloos avatar Prigozhenkov Maxim 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.