Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Fade figures under Reduce Motion instead of rolling their digits
Țugui Dragoș77129b237310
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2993454b..8542a0ca 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -762,6 +762,8 @@ its changes the way [Keep a Changelog](https://keepachangelog.com/) suggests.#### Every page+- With Reduce Motion on, figures fade to their new value instead of rolling, on Home, in the menu bar panel, and in the+ bars at a page's foot.- Apps' icons follow the icon style chosen in System Settings > Appearance at once, as the Dock does: Peel kept the oldstyle until it was opened again.- What VoiceOver hears as a list is read again waits for what it is saying: it cut off "Moved 1 item to the Trash"diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InflectionMarkupTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InflectionMarkupTests.swiftindex 4a6e053b..a78defa7 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/InflectionMarkupTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/InflectionMarkupTests.swift@@ -19,4 +19,16 @@ struct InflectionMarkupTests {}#expect(found.isEmpty, "String(localized:) shows inflection markup as written; use String(inflecting:): \(found)")}++ @Test func digitsRollOnlyThroughTheRuleThatAsksReduceMotion() throws {+ let call = ".numeric" + "Text("+ let root = LineLengthTests.repository.path(percentEncoded: false)+ var found: [String] = []+ let rule = ["Motion.swift", "MotionTests.swift"]+ for file in try LineLengthTests.swiftFiles() where !rule.contains(file.lastPathComponent) {+ let text = try String(contentsOf: file, encoding: .utf8)+ if text.contains(call) { found.append(String(file.path(percentEncoded: false).dropFirst(root.count))) }+ }+ #expect(found.isEmpty, "SwiftUI rolls digits under Reduce Motion too; use numberTransition(value:)")+ }}diff --git a/Peel/Views/Duplicates/DuplicateStatusViews.swift b/Peel/Views/Duplicates/DuplicateStatusViews.swiftindex c2186c59..3bff82d3 100644--- a/Peel/Views/Duplicates/DuplicateStatusViews.swift+++ b/Peel/Views/Duplicates/DuplicateStatusViews.swift@@ -100,7 +100,7 @@ struct DuplicateSummaryView: View {Label("Duplicates Found", systemImage: "doc.on.doc")} description: {Text("^[\(duplicates.selectedCount) item](inflect: true) selected of ^[\(duplicates.copyCount) copy](inflect: true) in ^[\(duplicates.groupCount) group](inflect: true). Choose one to review its copies.")- .contentTransition(.numericText(value: Double(duplicates.copyCount)))+ .numberTransition(value: Double(duplicates.copyCount)).motion(value: duplicates.copyCount)}// Takes the page's height, so the bar floats at its foot as on every page, not under these words.diff --git a/Peel/Views/History/HistoryDetailView.swift b/Peel/Views/History/HistoryDetailView.swiftindex 7b749e59..49884d9a 100644--- a/Peel/Views/History/HistoryDetailView.swift+++ b/Peel/Views/History/HistoryDetailView.swift@@ -189,7 +189,7 @@ private struct RestoreBar: View {Text("^[\(count) item](inflect: true)").font(.barFigure).monospacedDigit()- .contentTransition(.numericText(value: Double(count)))+ .numberTransition(value: Double(count))Text("Selected", comment: "A label after a figure at the foot of a page: a size, such as 303 kB, or a count, such as 3 items. Write it so it reads right after any figure, as \"en la selección\" does, never as a form that agrees with the number or adds (s).").foregroundStyle(.secondary)}diff --git a/Peel/Views/Home/HomeDeviceCard.swift b/Peel/Views/Home/HomeDeviceCard.swiftindex 4b766264..98bb1984 100644--- a/Peel/Views/Home/HomeDeviceCard.swift+++ b/Peel/Views/Home/HomeDeviceCard.swift@@ -32,7 +32,7 @@ struct DeviceSticker: View {Text(value).font(Self.valueFont).monospacedDigit()- .contentTransition(.numericText(value: amount ?? 0))+ .numberTransition(value: amount ?? 0).motion(value: value).lineLimit(1).minimumScaleFactor(0.65)@@ -97,7 +97,7 @@ struct StorageStrip: View {.font(isAlbum ? .system(size: 15, weight: .bold, design: .rounded) : .title3.weight(.semibold)).foregroundStyle(isAlbum ? AnyShapeStyle(Album.ink) : AnyShapeStyle(.primary)).monospacedDigit()- .contentTransition(.numericText(value: Double(storage.free)))+ .numberTransition(value: Double(storage.free))Spacer(minLength: 8)Text("of \(storage.total.byteCount)").font(.callout)@@ -125,7 +125,7 @@ struct StorageStrip: View {.font(.subheadline).foregroundStyle(.secondary).monospacedDigit()- .contentTransition(.numericText(value: Double(storage.used)))+ .numberTransition(value: Double(storage.used))}.motion(value: storage).accessibilityElement(children: .combine)diff --git a/Peel/Views/MenuBarPanel.swift b/Peel/Views/MenuBarPanel.swiftindex e038bb0d..3654f807 100644--- a/Peel/Views/MenuBarPanel.swift+++ b/Peel/Views/MenuBarPanel.swift@@ -120,7 +120,7 @@ struct MenuBarPanel: View {Text(stats.bytesFreed.text).font(.system(size: 50, weight: .bold, design: .rounded)).monospacedDigit()- .contentTransition(.numericText(value: Double(stats.bytesFreed.known)))+ .numberTransition(value: Double(stats.bytesFreed.known)).motion(value: stats.bytesFreed).minimumScaleFactor(0.6).lineLimit(1)@@ -229,7 +229,7 @@ struct MenuBarPanel: View {Text(verbatim: value).font(.system(size: 16, weight: .bold, design: .rounded)).monospacedDigit()- .contentTransition(.numericText(value: Double(amount)))+ .numberTransition(value: Double(amount)).motion(value: value).foregroundStyle(isAccented ? Album.orangeInk : .primary)if leadsSomewhere {diff --git a/Peel/Views/RemovalBar.swift b/Peel/Views/RemovalBar.swiftindex af4dad8f..0d5db9b2 100644--- a/Peel/Views/RemovalBar.swift+++ b/Peel/Views/RemovalBar.swift@@ -291,8 +291,7 @@ struct RemovalBar: View {Text(total.text).font(.barFigure).monospacedDigit()- // Given the value, the digits roll down when the total falls and up when it rises.- .contentTransition(.numericText(value: Double(total.known)))+ .numberTransition(value: Double(total.known)).id(total.textKind)}diff --git a/Peel/Views/Stickers/Motion.swift b/Peel/Views/Stickers/Motion.swiftindex 3e0f3b47..c4ddb7f0 100644--- a/Peel/Views/Stickers/Motion.swift+++ b/Peel/Views/Stickers/Motion.swift@@ -8,9 +8,9 @@ enum Motion {case stepcase settle- /// Whether an animated change moves something, or only changes it in place, such as its opacity, its color,- /// or a number. Reduce Motion turns off `movement` only: Apple's accessibility guidance asks for fades in- /// place of movement, not for no animation at all.+ /// Whether an animated change moves something, or only changes it in place, such as its opacity or its color.+ /// Reduce Motion turns off `movement` only: Apple's accessibility guidance asks for fades in place of movement,+ /// not for no animation at all.enum Kind {case fadecase movement@@ -33,6 +33,25 @@ extension View {func motion(_ speed: Motion = .step, _ kind: Motion.Kind = .fade, value: some Equatable) -> some View {modifier(MotionModifier(speed: speed, kind: kind, value: value))}++ /// A number's digits roll to `value`, down when it falls and up when it rises, or fade there under Reduce Motion.+ func numberTransition(value: Double) -> some View {+ modifier(NumberTransition(value: value))+ }+}++/// SwiftUI rolls the digits of `numericText` under Reduce Motion too, so this asks first.+struct NumberTransition: ViewModifier {+ @Environment(\.accessibilityReduceMotion) private var reduceMotion+ let value: Double++ static func transition(to value: Double, reducingMotion: Bool) -> ContentTransition {+ reducingMotion ? .opacity : .numericText(value: value)+ }++ func body(content: Content) -> some View {+ content.contentTransition(Self.transition(to: value, reducingMotion: reduceMotion))+ }}private struct MotionModifier<Value: Equatable>: ViewModifier {diff --git a/Peel/Views/TotalLabel.swift b/Peel/Views/TotalLabel.swiftindex 8341bb17..ae449b35 100644--- a/Peel/Views/TotalLabel.swift+++ b/Peel/Views/TotalLabel.swift@@ -20,7 +20,7 @@ struct TotalLabel: View {Text(total.text).font(.title2.weight(.semibold)).monospacedDigit()- .contentTransition(.numericText(value: Double(total.known)))+ .numberTransition(value: Double(total.known)).id(total.textKind).lineLimit(1).minimumScaleFactor(0.6)diff --git a/PeelTests/MotionTests.swift b/PeelTests/MotionTests.swiftnew file mode 100644index 00000000..1e7994f8--- /dev/null+++ b/PeelTests/MotionTests.swift@@ -0,0 +1,10 @@+import SwiftUI+@testable import Peel+import Testing++struct MotionTests {+ @Test func aNumberFadesToItsNewValueUnderReduceMotion() {+ #expect(NumberTransition.transition(to: 12, reducingMotion: true) == .opacity)+ #expect(NumberTransition.transition(to: 12, reducingMotion: false) == .numericText(value: 12))+ }+}