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
Count a section header's measurements with a sendable counter
Țugui Dragoșabe304c801d8
diff --git a/PeelTests/SectionHeaderLineTests.swift b/PeelTests/SectionHeaderLineTests.swiftindex ca374722..f324a5c7 100644--- a/PeelTests/SectionHeaderLineTests.swift+++ b/PeelTests/SectionHeaderLineTests.swift@@ -1,12 +1,16 @@import AppKit@testable import Peelimport SwiftUI+import Synchronizationimport Testing@MainActorstruct SectionHeaderLineTests {- private nonisolated final class Counter {- var count = 0+ private nonisolated final class Counter: Sendable {+ private let count = Mutex(0)+ var value: Int { count.withLock { $0 } }+ func add() { count.withLock { $0 += 1 } }+ func reset() { count.withLock { $0 = 0 } }}/// Counts how often SwiftUI asks the view inside for its size.@@ -14,7 +18,7 @@ struct SectionHeaderLineTests {let counter: Counterfunc sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {- counter.count += 1+ counter.add()return subviews.first?.sizeThatFits(proposal) ?? .zero}@@ -41,10 +45,10 @@ struct SectionHeaderLineTests {func size(of view: some View, width: CGFloat) -> (heading: Int, buttons: Int) {let host = NSHostingController(rootView: view)- heading.count = 0- buttons.count = 0+ heading.reset()+ buttons.reset()_ = host.sizeThatFits(in: CGSize(width: width, height: 200))- return (heading.count, buttons.count)+ return (heading.value, buttons.value)}}