naveedmcs / DockProgress

Show progress in your app's Dock icon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 9.3+
  • Swift 4.1+

Install

SPM

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

Carthage

github "sindresorhus/DockProgress"

CocoaPods

pod 'Preferences'

Usage

Manually set the progress

import Cocoa
import DockProgress

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

Specify a Progress instance

import Cocoa
import DockProgress

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

DockProgress.progress = progress

Styles

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

Related

  • Defaults - Swifty and modern UserDefaults
  • Preferences - Add a preferences window to your macOS app in minutes
  • LaunchAtLogin - Add "Launch at Login" functionality to your macOS app

License

MIT © Sindre Sorhus

About

Show progress in your app's Dock icon

License:MIT License


Languages

Language:Swift 92.4%Language:Ruby 7.6%