Minor tweaks
This commit is contained in:
parent
7c5f842b26
commit
c140f1112e
|
@ -12,8 +12,8 @@ public final class DockProgress {
|
||||||
public static var progress: Progress? {
|
public static var progress: Progress? {
|
||||||
didSet {
|
didSet {
|
||||||
if let progress = progress {
|
if let progress = progress {
|
||||||
progressObserver = progress.observe(\.fractionCompleted) { object, _ in
|
progressObserver = progress.observe(\.fractionCompleted) { sender, _ in
|
||||||
progressValue = object.fractionCompleted
|
progressValue = sender.fractionCompleted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,16 +59,19 @@ final class ProgressCircleShapeLayer: CAShapeLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extension NSColor {
|
extension NSColor {
|
||||||
func with(alpha: Double) -> NSColor {
|
func with(alpha: Double) -> NSColor {
|
||||||
return withAlphaComponent(CGFloat(alpha))
|
return withAlphaComponent(CGFloat(alpha))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extension NSFont {
|
extension NSFont {
|
||||||
static let helveticaNeueBold = NSFont(name: "HelveticaNeue-Bold", size: 0)
|
static let helveticaNeueBold = NSFont(name: "HelveticaNeue-Bold", size: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extension CGRect {
|
extension CGRect {
|
||||||
var center: CGPoint {
|
var center: CGPoint {
|
||||||
get {
|
get {
|
||||||
|
@ -113,6 +116,7 @@ extension NSBezierPath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Fixes the vertical alignment issue of the `CATextLayer` class.
|
/// Fixes the vertical alignment issue of the `CATextLayer` class.
|
||||||
final class VerticallyCenteredTextLayer: CATextLayer {
|
final class VerticallyCenteredTextLayer: CATextLayer {
|
||||||
convenience init(frame rect: CGRect, center: CGPoint) {
|
convenience init(frame rect: CGRect, center: CGPoint) {
|
||||||
|
|
|
@ -47,8 +47,8 @@ pod 'DockProgress'
|
||||||
import Cocoa
|
import Cocoa
|
||||||
import DockProgress
|
import DockProgress
|
||||||
|
|
||||||
foo.onUpdate = { progress in
|
foo.onUpdate = { progressValue in
|
||||||
DockProgress.progressValue = progress
|
DockProgress.progressValue = progressValue
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ DockProgress.progress = progress
|
||||||
|
|
||||||
## Styles
|
## Styles
|
||||||
|
|
||||||
It comes with two styles. PR welcome for more.
|
It comes with three styles. PR welcome for more.
|
||||||
|
|
||||||
Check out the example app in the Xcode project.
|
Check out the example app in the Xcode project.
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ import DockProgress
|
||||||
DockProgress.style = .badge(color: .systemBlue, badgeValue: { getDownloadCount() })
|
DockProgress.style = .badge(color: .systemBlue, badgeValue: { getDownloadCount() })
|
||||||
```
|
```
|
||||||
|
|
||||||
Large `badgeValue` numbers will be written in kilo short notation, for example, `1000` → `1k`.
|
Large `badgeValue` numbers will be written in kilo short notation, for example, `1012` → `1k`.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue