QuietUnrar/Carthage/Checkouts/DockProgress
Robert McGovern 929688681b Added DockProgress to Carthage
Added DockProgress, plus commited projects
2021-05-27 18:06:29 +01:00
..
.github Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
.swiftpm/xcode/package.xcworkspace Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
DockProgress.xcodeproj Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
Example Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
Sources/DockProgress Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
.editorconfig Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
.gitattributes Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
.gitignore Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
.swiftlint.yml Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
DockProgress.podspec Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
Package.swift Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
license Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
readme.md Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
screenshot-badge.gif Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
screenshot-bar.gif Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
screenshot-circle.gif Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
screenshot-squircle.gif Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00
screenshot.gif Added DockProgress to Carthage 2021-05-27 18:06:29 +01:00

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 12+
  • Swift 5.3+

Install

Swift Package Manager

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

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

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

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.

Squircle

import DockProgress

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

By default, it should perfectly fit a macOS 11 icon, but there's a inset parameter if you need to make any adjustments.

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.