Skip to content
Show progress in your app's Dock icon
Swift Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Enable the repo Sponsor button May 23, 2019
.swiftpm/xcode/package.xcworkspace
DockProgress.xcodeproj
Example Upgrade to Swift 5.1 Sep 11, 2019
Sources/DockProgress Upgrade to Swift 5.1 Sep 11, 2019
.editorconfig Init Mar 1, 2018
.gitattributes Fix Package.swift file Jun 29, 2018
.gitignore Init Mar 1, 2018
.swiftlint.yml Upgrade to Swift 5.1 Sep 11, 2019
DockProgress.podspec
Package.swift
license Init Mar 1, 2018
readme.md Upgrade to Swift 5.1 Sep 11, 2019
screenshot-badge.gif Add `badge` circle style (#7) Jan 25, 2019
screenshot-bar.gif Init Mar 1, 2018
screenshot-circle.gif Init Mar 1, 2018
screenshot.gif Init Mar 1, 2018

readme.md

DockProgress

Show progress in your app's Dock icon

This package is used in production by the Gifski app. You might also like some of my other apps.

Requirements

  • macOS 10.12+
  • Xcode 10.2+
  • Swift 5.1+

Install

SwiftPM

.package(url: "https://github.com/sindresorhus/DockProgress", from: "2.0.0")

Carthage

github "sindresorhus/DockProgress"

CocoaPods

pod 'DockProgress'

Usage

Manually set the progress

import Cocoa
import DockProgress

foo.onUpdate = { progress in
	DockProgress.progress = progress
}

Specify a Progress instance

import Cocoa
import DockProgress

let progress = Progress(totalUnitCount: 1)
progress?.becomeCurrent(withPendingUnitCount: 1)

DockProgress.progressInstance = progress

Styles

It comes with three styles. PR welcome for more.

Check out the example app in the Xcode project.

You can also draw a custom progress with .custom(drawHandler: (_ rect: CGRect) -> Void).

Bar

import DockProgress

DockProgress.style = .bar

This is the default.

Circle

import DockProgress

DockProgress.style = .circle(radius: 55, color: .systemBlue)

Make sure to set a radius that matches your app icon.

Badge

import DockProgress

DockProgress.style = .badge(color: .systemBlue, badgeValue: { getDownloadCount() })

Large badgeValue numbers will be written in kilo short notation, for example, 10121k.

Note: The badgeValue is not meant to be used as a numeric percentage. It's for things like count of downloads, number of files being converted, etc.

Related

You can’t perform that action at this time.