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
Show a Space area's step whole beside its label on macOS 27
Țugui Dragoș9d17a078aa1f
diff --git a/Peel/Views/Space/SpaceDetailView.swift b/Peel/Views/Space/SpaceDetailView.swiftindex 942eccf1..bd4b3bb5 100644--- a/Peel/Views/Space/SpaceDetailView.swift+++ b/Peel/Views/Space/SpaceDetailView.swift@@ -38,10 +38,14 @@ struct SpaceDetailView: View {if item.howToFreeIt != nil || !item.commands.isEmpty {LabeledContent {if let hint = item.howToFreeIt {- Text(hint)- .font(.callout)- .textSelection(.enabled)- .multilineTextAlignment(.trailing)+ if #available(macOS 27, *) {+ SpaceStep(step: hint)+ } else {+ Text(hint)+ .font(.callout)+ .textSelection(.enabled)+ .multilineTextAlignment(.trailing)+ }}} label: {titled(@@ -263,3 +267,18 @@ struct SpaceDetailView: View {}}}++/// What frees an area's space, beside its label. On macOS 27 a list lays out a selectable text aligned to the trailing+/// edge narrower than it measured it, which cut its last lines, so the text asks for its whole height.+@available(macOS 27, *)+struct SpaceStep: View {+ let step: LocalizedStringResource++ var body: some View {+ Text(step)+ .font(.callout)+ .textSelection(.enabled)+ .multilineTextAlignment(.trailing)+ .fixedSize(horizontal: false, vertical: true)+ }+}diff --git a/PeelTests/SpaceStepTests.swift b/PeelTests/SpaceStepTests.swiftnew file mode 100644index 00000000..15846721--- /dev/null+++ b/PeelTests/SpaceStepTests.swift@@ -0,0 +1,45 @@+import AppKit+@testable import Peel+import SwiftUI+import Testing++@MainActor+struct SpaceStepTests {+ private final class Frame {+ var size: CGSize = .zero+ }++ private static let step = "Remove a version with a newer one beside it by dragging its folder to the Trash in Finder, or with Microsoft’s .NET Uninstall Tool. Finder asks for an administrator’s password for a version in /usr/local."++ @Test func aLongStepBesideItsLabelShowsEveryLine() async {+ guard #available(macOS 27, *) else { return }+ let frame = Frame()+ let page = List {+ Section {+ LabeledContent {+ SpaceStep(step: LocalizedStringResource(stringLiteral: Self.step))+ .onGeometryChange(for: CGSize.self) { $0.size } action: { frame.size = $0 }+ } label: {+ Text(verbatim: "How to free it")+ }+ }+ }+ let window = NSWindow(+ contentRect: NSRect(x: 0, y: 0, width: 760, height: 560), styleMask: [.titled],+ backing: .buffered, defer: true+ )+ window.contentView = NSHostingView(rootView: page)++ for _ in 0..<200 where frame.size == .zero {+ window.layoutIfNeeded()+ try? await Task.sleep(for: .milliseconds(5))+ }++ let needed = (Self.step as NSString).boundingRect(+ with: CGSize(width: frame.size.width, height: 10_000), options: [.usesLineFragmentOrigin, .usesFontLeading],+ attributes: [.font: NSFont.preferredFont(forTextStyle: .callout)]+ ).height+ #expect(frame.size.width > 0)+ #expect(frame.size.height + 1 >= needed.rounded(.up))+ }+}