##Requirements
- Swift 3
- Xcode 8
- iOS 8+
RappleProgressHUD is available through CocoaPods. To install it, simply add the following line to your Podfile:
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.
this is the text value we are gonna display with the animated indicator
this is a dictionary with following Keys.
RappleTintColorKey
Color of the progress circle and textRappleScreenBGColorKey
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 stylesRappleProgressBarColorKey
Progress bar bg color - track bg colorRappleProgressBarFillColorKey
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 ActivityIndicatorRappleStyleCircle
Custom Circular ActivityIndicatorRappleStyleText
Custom Texual ActivityIndicator (e.g. Loading.. | Loading....)
RappleActivityIndicatorView has two pre-defines attribute sets for ease of use
RappleTintColorKey
whiteRappleScreenBGColorKey
white: 0.0, alpha: 0.2RappleProgressBGColorKey
white: 0.0, alpha: 0.7RappleIndicatorStyleKey
RappleStyleAppleRappleProgressBarColorKey
lightGrayRappleProgressBarFillColorKey
white
RappleTintColorKey
whiteRappleScreenBGColorKey
white: 0.0, alpha: 0.5RappleProgressBGColorKey
N/ARappleIndicatorStyleKey
RappleStyleCircleRappleProgressBarColorKey
lightGrayRappleProgressBarFillColorKey
white
RappleTintColorKey
whiteRappleScreenBGColorKey
white: 0.0, alpha: 0.5RappleProgressBGColorKey
N/ARappleIndicatorStyleKey
RappleStyleTextRappleProgressBarColorKey
N/ARappleProgressBarFillColorKey
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)
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)
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 indicatorsuccess
✓ symbolfailed
✕ symbolincomplete
! symbolunknown
? symbol
- 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 barRappleStyleCircle
will use circular progress barRappleStyleText
will not display any progress bar
RappleActivityIndicatorView.setProgress(0.2, textValue: "1/5")
RappleActivityIndicatorView.setProgress(0.2) // Display with percentage value
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()
To run the example project, clone the repo, and run pod install
from the Example directory first.
Check CocoaPodTester project for more
Rajeev Prasad, [email protected]
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.