{"id":13466231,"url":"https://github.com/sindresorhus/CircularProgress","last_synced_at":"2025-03-25T21:31:34.608Z","repository":{"id":44432573,"uuid":"153606623","full_name":"sindresorhus/CircularProgress","owner":"sindresorhus","description":"Circular progress indicator for your macOS app","archived":false,"fork":false,"pushed_at":"2024-02-20T07:32:46.000Z","size":3993,"stargazers_count":577,"open_issues_count":3,"forks_count":52,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-20T09:22:24.348Z","etag":null,"topics":["carthage","cocoapods","macos","progress-circle","progress-indicator","progress-view","swift","swift-package"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2018-10-18T10:31:42.000Z","updated_at":"2025-01-15T03:59:46.000Z","dependencies_parsed_at":"2024-02-26T22:15:23.204Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/CircularProgress","commit_stats":{"total_commits":74,"total_committers":6,"mean_commits":"12.333333333333334","dds":"0.16216216216216217","last_synced_commit":"576adc48fee51b27ac51f0271297f9f69571e9e6"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FCircularProgress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FCircularProgress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FCircularProgress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2FCircularProgress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/CircularProgress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245295015,"owners_count":20591967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carthage","cocoapods","macos","progress-circle","progress-indicator","progress-view","swift","swift-package"],"created_at":"2024-07-31T15:00:41.320Z","updated_at":"2025-03-25T21:31:34.563Z","avatar_url":"https://github.com/sindresorhus.png","language":"Swift","readme":"# CircularProgress\n\n\u003e Circular progress indicator for your macOS app\n\n\u003cimg src=\"screenshot.gif\" width=\"834\"\u003e\n\nThis package is used in production by apps like [Gifski](https://github.com/sindresorhus/Gifski) and [HEIC Converter](https://sindresorhus.com/heic-converter).\n\n## Requirements\n\nmacOS 10.15+\n\n## Install\n\nAdd `https://github.com/sindresorhus/CircularProgress` in the [“Swift Package Manager” tab in Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).\n\n*Latest version: 3.0.1*\n\n## Usage\n\nAlso check out the example app in the Xcode project.\n\n### Manually set the progress\n\n```swift\nimport Cocoa\nimport CircularProgress\n\n@main\nfinal class AppDelegate: NSObject, NSApplicationDelegate {\n\t@IBOutlet private var window: NSWindow!\n\n\tlet circularProgress = CircularProgress(size: 200)\n\n\tfunc applicationDidFinishLaunching(_ notification: Notification) {\n\t\twindow.contentView!.addSubview(circularProgress)\n\n\t\tfoo.onUpdate = { progress in\n\t\t\tself.circularProgress.progress = progress\n\t\t}\n\t}\n}\n```\n\n### Specify a [`Progress`](https://developer.apple.com/documentation/foundation/progress) instance\n\nThe given `Progress` instance is strongly kept alive as long as the `CircularProgress` instance or until you set `.progressInstance = nil`.\n\n```swift\nimport Cocoa\nimport CircularProgress\n\n@main\nfinal class AppDelegate: NSObject, NSApplicationDelegate {\n\t@IBOutlet private var window: NSWindow!\n\n\tlet circularProgress = CircularProgress(size: 200)\n\tlet progress = Progress(totalUnitCount: 1)\n\n\tfunc applicationDidFinishLaunching(_ notification: Notification) {\n\t\twindow.contentView!.addSubview(circularProgress)\n\n\t\tprogress?.becomeCurrent(withPendingUnitCount: 1)\n\t\tcircularProgress.progressInstance = progress\n\t}\n}\n```\n\n### Cancel button\n\n\u003cimg src=\"screenshot-cancel.gif\" width=\"300\" align=\"right\"\u003e\n\nIf you use the `.progress` property, you need to opt into the cancel button by setting `.isCancellable = true`. You can be notified of when the button is clicked by setting the `.onCancelled` property to a closure.\n\nIf you use the `.progressInstance` property, setting a `Progress` object that is [`isCancellable`](https://developer.apple.com/documentation/foundation/progress/1409348-iscancellable), which is the default, automatically enables the cancel button.\n\n\u003cimg src=\"screenshot-desaturate.gif\" width=\"111\" align=\"right\"\u003e\n\nPer default, the cancelled state is indicated by desaturing the current color and reducing the opacity. You can customize this by implementing the `.cancelledStateColorHandler` callback and returning a color to use for the cancelled state instead. The opacity is not automatically reduced when the callback has been set. To disable the cancelled state visualization entirely, set `.visualizeCancelledState` to `false`.\n\n### Indeterminate state\n\n\u003cimg src=\"screenshot-indeterminate.gif\" width=\"118\" align=\"right\"\u003e\n\nDisplays a state that indicates that the remaining progress is indeterminate.\n\nNote that the `.progress` property and `.isIndeterminate` are not tied together. You'll need to manually set `.isIndeterminate = false` when progress is being made again.\n\nIf you use the `.progressInstance` property, the [`isIndeterminate`](https://developer.apple.com/documentation/foundation/progress/1412871-isindeterminate) property will automatically be observed. The view will then switch back and forth to the indeterminate state when appropriate.\n\n### Hidden progress label\n\n\u003cimg src=\"screenshot-hiddenLabel.gif\" width=\"118\" align=\"right\"\u003e\n\nDisplays a spinner without a percentage indicator in the center.\n\nThis is accomplished by setting the `.isLabelHidden` property to `true`. The default state is `false` (the label is displayed).\n\n## API\n\n```swift\n/**\nColor of the circular progress view.\n*/\n@IBInspectable var color: NSColor = .controlAccentColor\n\n/**\nLine width of the circular progress view.\n*/\n@IBInspectable var lineWidth: Double = 2\n\n/**\nShow an animated checkmark instead of `100%`.\n*/\n@IBInspectable var showCheckmarkAtHundredPercent = true\n\n/**\nHide the progress label.\n\nThe property supports KVO.\n*/\n@IBInspectable var isLabelHidden = true\n\n/**\nThe progress value in the range `0...1`.\n\n- Note: The value will be clamped to `0...1`.\n*/\n@IBInspectable var progress: Double = 0\n\n/**\nLet a `Progress` instance update the `progress` for you.\n*/\nvar progressInstance: Progress?\n\n/**\nReset the progress back to zero without animating.\n*/\nfunc resetProgress() {}\n\n/**\nCancels `Progress` if it's set and prevents further updates.\n*/\nfunc cancelProgress() {}\n\n/**\nTriggers when the progress was cancelled succesfully.\n*/\nvar onCancelled: (() -\u003e Void)?\n\n/**\nReturns whether the progress is finished.\n\nThe property supports KVO.\n*/\n@IBInspectable var isFinished: Bool { get }\n\n/**\nIf the progress view is cancellable it shows the cancel button.\n*/\n@IBInspectable var isCancellable: Bool\n\n/**\nMake the progress indeterminate.\n\nThe property supports KVO.\n*/\n@IBInspectable var isIndeterminate: Bool\n\n/**\nReturns whether the progress has been cancelled.\n\nThe property supports KVO.\n*/\n@IBInspectable var isCancelled: Bool { get }\n\n/**\nDetermines whether to visualize changing into the cancelled state.\n*/\nvar visualizeCancelledState: Bool = true\n\n/**\nSupply the base color to use for displaying the cancelled state.\n*/\nvar cancelledStateColorHandler: ((NSColor) -\u003e NSColor)?\n\ninit(frame: CGRect) {}\ninit?(coder: NSCoder) {}\n\n/**\nInitialize the progress view with a width/height of the given `size`.\n*/\nconvenience init(size: Double) {}\n```\n\n## Related\n\n- [DockProgress](https://github.com/sindresorhus/DockProgress) - Show progress in your app's Dock icon\n- [Defaults](https://github.com/sindresorhus/Defaults) - Swifty and modern UserDefaults\n- [KeyboardShortcuts](https://github.com/sindresorhus/KeyboardShortcuts) - Add user-customizable global keyboard shortcuts to your macOS app\n- [LaunchAtLogin](https://github.com/sindresorhus/LaunchAtLogin) - Add \"Launch at Login\" functionality to your macOS app\n- [More…](https://github.com/search?q=user%3Asindresorhus+language%3Aswift+archived%3Afalse\u0026type=repositories)\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Libs","Swift","Progress","UI [🔝](#readme)","OOM-Leaks-Crash"],"sub_categories":["UI","WebView-ProgressBar"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2FCircularProgress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2FCircularProgress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2FCircularProgress/lists"}