All Projects → jkandzi → Progress.swift

jkandzi / Progress.swift

Licence: mit
⌛️ Add beautiful progress bars to your loops.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Progress.swift

Swiftytexttable
A lightweight library for generating text tables.
Stars: ✭ 252 (-4.91%)
Mutual labels:  command-line, cocoapods, carthage
Multiprogressview
📊 An animatable view that depicts multiple progresses over time. Modeled after UIProgressView
Stars: ✭ 614 (+131.7%)
Mutual labels:  cocoapods, carthage, progress-bar
Dockprogress
Show progress in your app's Dock icon
Stars: ✭ 813 (+206.79%)
Mutual labels:  cocoapods, carthage, progress-bar
Datez
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!
Stars: ✭ 254 (-4.15%)
Mutual labels:  cocoapods, carthage
Yoshi
A convenient wrapper around the UI code that is often needed for displaying debug menus.
Stars: ✭ 263 (-0.75%)
Mutual labels:  cocoapods, carthage
Sensor Visualizer Kit
Visualize iOS sensors for live presentations, iOS AppStore demos, Apple Store prototypes, design reviews.
Stars: ✭ 242 (-8.68%)
Mutual labels:  cocoapods, carthage
Sync
JSON to Core Data and back. Swift Core Data Sync.
Stars: ✭ 2,538 (+857.74%)
Mutual labels:  cocoapods, carthage
Wechatkit
一款快速实现微信第三方登录的框架(Swift版) SDK 1.8.5
Stars: ✭ 249 (-6.04%)
Mutual labels:  cocoapods, carthage
Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (-8.68%)
Mutual labels:  cocoapods, carthage
Uxmpdfkit
An iOS PDF viewer and annotator written in Swift that can be embedded into any application.
Stars: ✭ 260 (-1.89%)
Mutual labels:  cocoapods, carthage
Colorizeswift
Terminal string styling for Swift.
Stars: ✭ 253 (-4.53%)
Mutual labels:  cocoapods, carthage
Swiftpagemenu
Customizable Page Tab Menu Controller 👍
Stars: ✭ 233 (-12.08%)
Mutual labels:  cocoapods, carthage
Swipycell
Easy to use UITableViewCell implementing swiping to trigger actions.
Stars: ✭ 230 (-13.21%)
Mutual labels:  cocoapods, carthage
Gifu
High-performance animated GIF support for iOS in Swift
Stars: ✭ 2,703 (+920%)
Mutual labels:  cocoapods, carthage
Localize
Localize is a framework writed in swift to localize your projects easier improves i18n, including storyboards and strings.
Stars: ✭ 253 (-4.53%)
Mutual labels:  cocoapods, carthage
Node.cli Progress
⌛️ easy to use progress-bar for command-line/terminal applications
Stars: ✭ 466 (+75.85%)
Mutual labels:  command-line, progress-bar
Harpy
Harpy checks a user's currently installed version of your iOS app against the version that is currently available in the App Store. If a new version is available, an alert can be presented to the user informing them of the newer version, and giving them the option to update the application.
Stars: ✭ 2,619 (+888.3%)
Mutual labels:  cocoapods, carthage
Corestore
Unleashing the real power of Core Data with the elegance and safety of Swift
Stars: ✭ 3,254 (+1127.92%)
Mutual labels:  cocoapods, carthage
Tutti
Tutti is a Swift library that lets you create tutorials, hints and onboarding experiences.
Stars: ✭ 224 (-15.47%)
Mutual labels:  cocoapods, carthage
Admozaiccollectionviewlayout
ADMozaicCollectionViewLayout is yet another UICollectionViewLayout subclass that implements "brick", "mozaic" or Pinterest style layout.
Stars: ✭ 226 (-14.72%)
Mutual labels:  cocoapods, carthage

Progress.swift ⌛️

Build Status codecov.io Carthage compatible SPM ready Version License Platform

demo gif

Just wrap the SequenceType in your loop with the Progress SequenceType and you'll automatically get beautiful progress bars.

Updating the progress bar does not work in the Xcode console because it does not support the cursor movements. If you want it to look nice run it in a real terminal.

Example

Just take a regular loop like this for i in 1...9 { ... and wrap the 1...9 range in the Progress type and you'll automatically get a nice progress bar.

import Progress

for i in Progress(1...9) {
    ...
}

Creates this output:

$ 4 of 9 [-------------                 ] ETA: 0:00:05 (at 1.01 it/s)

It also works with all the other types adopting the CollectionType protocol like dictionarys: Progress(["key": "value", "key2": "also value"]) and arrays: Progress([1, 52, 6, 26, 1]).

You can also create the progress bar manually without a sequence type:

var bar = ProgressBar(count: 4)

for i in 0...3 {
    bar.next()
    sleep(1)
}

Configuration

You can configure the progress bar by combining single building blocks of type ProgressElementType.

Either by setting a default configuration:

ProgressBar.defaultConfiguration = [ProgressString(string: "Percent done:"), ProgressPercent()]

which creates the following result:

$ Percent done: 80%

or by providing a specific configuration in the Process initializer:

Progress(0...10, configuration: [ProgressPercent(), ProgressBarLine(barLength: 60)])

resulting in something like this:

$ 100% [------------------------------------------------------------]

Available ProgressElementType elements:

  • ProgressBarLine (The actual bar. E.g. "[---------------------- ]").
  • ProgressIndex (The current index & overall count. E.g. "2 of 3").
  • ProgressPercent (The progress in percent. E.g. "60%").
  • ProgressTimeEstimates (Estimated time remaining & items per second. E.g. "ETA: 00:00:02 (at 1.00 it/s)").
  • ProgressString (Adds an arbitrary string to the progress bar).

Installation

Cocoapods

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

pod "Progress.swift"

Carthage

To integrate Progress.swift into your Xcode project using Carthage, specify it in your Cartfile:

github "jkandzi/Progress.swift"

Run carthage update to build the framework and drag the built Progress.framework into your Xcode project.

Swift Package Manager

To install with the Swift Package Manager, add the following in your Package.swift:

import PackageDescription

let package = Package(
    name: "MyProject",
    dependencies: [
        .Package(url: "https://github.com/jkandzi/Progress.swift", majorVersion: 0)
    ]
)

Manual

You can also copy the Progress.swift file into your Xcode project.

Contribution

You are welcome to fork and submit pull requests.

Author

Justus Kandzi, [email protected]

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].