DockProgress:在程序坞(Dock)应用图标区域显示进程条。

网友投稿 890 2022-10-18

DockProgress:在程序坞(Dock)应用图标区域显示进程条。

DockProgress:在程序坞(Dock)应用图标区域显示进程条。

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+Swift 4+

Install

With SPM:

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

With Carthage:

github "sindresorhus/DockProgress"

Usage

Manually set the progress

import Cocoaimport DockProgressfoo.onUpdate = { progress in DockProgress.progressValue = progress}

Specify a Progress instance

import Cocoaimport DockProgresslet progress = Progress(totalUnitCount: 1)progress?.becomeCurrent(withPendingUnitCount: 1)DockProgress.progress = progress

Styles

It comes with two styles. PR welcome for more.

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

Bar

import DockProgressDockProgress.style = .bar

This is the default.

Circle

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

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

Related

LaunchAtLogin - Add "Launch at Login" functionality to your macOS app

License

MIT © Sindre Sorhus

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Qt图片滚动预览
下一篇:解决繁琐的小程序会话管理,一款自带登录态管理的网络请求组件。
相关文章

 发表评论

暂时没有评论,来抢沙发吧~