Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keygx/GradientCircularProgress
Customizable progress indicator library in Swift
https://github.com/keygx/GradientCircularProgress
carthage cocoapods customizable ios progress-circle swift ui xcode
Last synced: 6 days ago
JSON representation
Customizable progress indicator library in Swift
- Host: GitHub
- URL: https://github.com/keygx/GradientCircularProgress
- Owner: keygx
- License: mit
- Created: 2015-06-20T14:58:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-08-26T12:08:20.000Z (over 3 years ago)
- Last Synced: 2024-08-16T04:31:30.360Z (4 months ago)
- Topics: carthage, cocoapods, customizable, ios, progress-circle, swift, ui, xcode
- Language: Swift
- Homepage:
- Size: 597 KB
- Stars: 542
- Watchers: 18
- Forks: 84
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - GradientCircularProgress - Customizable progress indicator library in Swift. (UI / ProgressView)
- awesome-cocoa - GradientCircularProgress
- awesome-gradient - GradientCircularProgress - Customizable progress indicator library. (Swift)
- awesome-ios-star - GradientCircularProgress - Customizable progress indicator library in Swift. (UI / ProgressView)
- awesome - GradientCircularProgress - Customizable progress indicator library in Swift. (OOM-Leaks-Crash / WebView-ProgressBar)
README
# Gradient Circular Progress
Customizable progress indicator library in Swift
## Requirements
- Swift 5.1
- iOS 8.0 or later## Screen Shots
- Preset style: [BlueDarkStyle.swift](https://github.com/keygx/GradientCircularProgress/blob/master/Source/BlueDarkStyle.swift)
![](images/scr_BlueDarkStyle_01.png) ![](images/scr_BlueDarkStyle_02.png)
- All preset styles
![](images/styles_01.png)
![](images/styles_02.png)- Example Use AddSubView
![](images/scr_AddSubViewEx_01.png) ![](images/scr_AddSubViewEx_02.png)
## Installation
### Carthage
```Cartfile
github "keygx/GradientCircularProgress"
```### CocoaPods
```PodFile
pod 'GradientCircularProgress', :git => 'https://github.com/keygx/GradientCircularProgress'
```### Swift versions support
- Swift 5.1, tag "swift5.1"
- Swift 5, tag "swift5"
- Swift 4.2, tag "swift4.2"
- Swift 4.1, tag "swift4.1"
- Swift 4.0, tag "swift4.0"## Style Settings
Please make your original styles
![](images/properties.png)
- Define custom style structs that implements the StyleProperty Protocol
[MyStyle.swift](https://github.com/keygx/GradientCircularProgress/blob/master/Sample/MyStyle.swift)
```swift
import GradientCircularProgresspublic struct MyStyle : StyleProperty {
/*** style properties **********************************************************************************/
// Progress Size
public var progressSize: CGFloat = 200
// Gradient Circular
public var arcLineWidth: CGFloat = 18.0
public var startArcColor: UIColor = UIColor.clear()
public var endArcColor: UIColor = UIColor.orange()
// Base Circular
public var baseLineWidth: CGFloat? = 19.0
public var baseArcColor: UIColor? = UIColor.darkGray()
// Ratio
public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 16.0)
public var ratioLabelFontColor: UIColor? = UIColor.white()
// Message
public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
public var messageLabelFontColor: UIColor? = UIColor.white()
// Background
public var backgroundStyle: BackgroundStyles = .dark
// Dismiss
public var dismissTimeInterval: Double? = 0.0 // 'nil' for default setting.
/*** style properties **********************************************************************************/
public init() {}
}```
![](images/scr_MyStyle.png)
## Usage
```swift
import GradientCircularProgress
```
### Basic
#### UIWindow
```swift
let progress = GradientCircularProgress()progress.show(message: "Loading...", MyStyle())
progress.dismiss()
```
#### addSubView
```swift
let progress = GradientCircularProgress()let progressView = progress.show(frame: rect, message: "Loading...", style: MyStyle())
view.addSubview(progressView!)progress.dismiss(progress: progressView!)
```### at Rtio
#### UIWindow
```swift
let progress = GradientCircularProgress()let ratio: CGFloat = CGFloat(totalBytesWritten) / CGFloat(totalBytesExpectedToWrite)
progress.showAtRatio(style: MyStyle())progress.updateRatio(ratio)
progress.dismiss()
```
#### addSubView
```swift
let progress = GradientCircularProgress()let progressView = progress.showAtRatio(frame: rect, display: true, style: MyStyle())
view.addSubview(progressView!)progress.updateRatio(ratio)
progress.dismiss(progress: progressView!)
```### Update Message
#### UIWindow
```swift
let progress = GradientCircularProgress()progress.show(message: "Download\n0 / 4", MyStyle())
progress.updateMessage(message: "Download\n1 / 4")
progress.updateMessage(message: "Download\n2 / 4")
progress.updateMessage(message: "Download\n3 / 4")
progress.updateMessage(message: "Download\n4 / 4")
progress.updateMessage(message: "Completed!")progress.dismiss()
```
#### addSubView
```swift
let progress = GradientCircularProgress()let progressView = progress.show(frame: rect, message: "Download\n0 / 4", style: MyStyle())
view.addSubview(progressView!)progress.updateMessage(message: "Download\n1 / 4")
progress.updateMessage(message: "Download\n2 / 4")
progress.updateMessage(message: "Download\n3 / 4")
progress.updateMessage(message: "Download\n4 / 4")
progress.updateMessage(message: "Completed!")progress.dismiss(progress: progressView!)
```## API
### Use UIWindow
```swift
public func showAtRatio(display: Bool = true, style: StyleProperty = Style())public func show(style: StyleProperty = Style())
public func show(message: String, style: StyleProperty = Style())
public func dismiss()
public func dismiss(_ completionHandler: () -> Void) -> ()
```### Use addSubView
```swift
public func showAtRatio(frame: CGRect, display: Bool = true, style: StyleProperty = Style()) -> UIView?public func show(frame: CGRect, style: StyleProperty = Style()) -> UIView?
public func show(frame: CGRect, message: String, style: StyleProperty = Style()) -> UIView?
public func dismiss(progress view: UIView)
public func dismiss(progress view: UIView, completionHandler: () -> Void) -> ()
```### Common
```swift
public func updateMessage(message message: String)public func updateRatio(_ ratio: CGFloat)
```## License
Gradient Circular Progress is released under the MIT license. See LICENSE for details.
## Author
Yukihiko Kagiyama (keygx)