洞察探索open banking如何通过小程序容器技术助力金融企业实现数据安全和数字化转型
1250
2022-10-22
CircularProgress - macOS应用程序的循环进度指示器
CircularProgress
Circular progress indicator for your macOS app
This package is used in production by the Gifski and HEIC Converter app.
Requirements
macOS 10.12+Xcode 10+Swift 4.2+
Install
SwiftPM
.package(url: "https://github.com/sindresorhus/CircularProgress", from: "0.1.2")
Carthage
github "sindresorhus/CircularProgress"
CocoaPods
pod 'CircularProgressMac'
Usage
Also check out the example app in the Xcode project.
Manually set the progress
import Cocoaimport CircularProgress@NSApplicationMainfinal class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet private var window: NSWindow! let circularProgress = CircularProgress(size: 200) func applicationDidFinishLaunching(_ notification: Notification) { window.contentView!.addSubview(circularProgress) foo.onUpdate = { progress in self.circularProgress.progress = progress } }}
Specify a Progress instance
import Cocoaimport CircularProgress@NSApplicationMainfinal class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet private var window: NSWindow! let progress = Progress(totalUnitCount: 1) func applicationDidFinishLaunching(_ notification: Notification) { window.contentView!.addSubview(circularProgress) progress?.becomeCurrent(withPendingUnitCount: 1) circularProgress.progressInstance = progress }}
API
/**Color of the circular progress view.Defaults to the user's accent color. For High Sierra and below it uses a fallback color.*/@IBInspectable var color: NSColor = .controlAccentColor/**Show `✔` instead `100%`.*/@IBInspectable var showCheckmarkAtHundredPercent: Bool = true/**The progress value in the range `0...1`.- Note: The value will be clamped to `0...1`.*/@IBInspectable var progress: Double = 0/**Let a `Progress` instance update the `progress` for you.*/var progressInstance: Progress?/**Reset the progress back to zero without animating.*/func resetProgress() {}init(frame: CGRect) {}init?(coder: NSCoder) {}/**Initialize the progress view with a width/height of the given `size`.*/convenience init(size: Double) {}
Related
DockProgress - Show progress in your app's Dock iconDefaults - Swifty and modern UserDefaultsPreferences - Add a preferences window to your macOS appLaunchAtLogin - Add "Launch at Login" functionality to your macOS appMore…
You might also like my apps.
License
MIT © Sindre Sorhus
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~