Swiftpack.co - sindresorhus/DockProgress as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by sindresorhus.
sindresorhus/DockProgress v4.1.0
Show progress in your app's Dock icon
⭐️ 994
🕓 2 weeks ago
.package(url: "https://github.com/sindresorhus/DockProgress.git", from: "v4.1.0")


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.


macOS 10.15+


Add https://github.com/sindresorhus/DockProgress in the “Swift Package Manager” tab in Xcode.

Latest version: 4.1.0


Manually set the progress

import DockProgress

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

Specify a Progress instance

import Foundation
import DockProgress

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

DockProgress.progressInstance = progress

The given Progress instance is weakly stored. It's up to you to retain it.


It comes with five 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).


import DockProgress


This is the default.


import DockProgress

DockProgress.style = .squircle(color: .white.withAlphaComponent(0.5))

By default, it should perfectly fit a macOS 11 and later icon, but there is an inset parameter if you need to make any adjustments.


import DockProgress

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

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


import DockProgress

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

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

**Note:*src="https://raw.github.com/sindresorhus/DockProgress/main/ 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.


import DockProgress

DockProgress.style = .pie(color: .systemBlue)


  • Defaults - Swifty and modern UserDefaults
  • Preferences - Add a preferences window to your macOS app in minutes
  • KeyboardShortcuts - Add user-customizable global keyboard shortcuts to your macOS app
  • LaunchAtLogin - Add "Launch at Login" functionality to your macOS app
  • Regex - Swifty regular expressions
  • More…


Stars: 994
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2 weeks ago
  • Add .pie style
  • Hide the progress display when progress is 0


Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics