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
Keep the screenshot folder panel's delegate alive in a release build
Țugui Dragoșf80ef96b3937
diff --git a/Peel/Model/ScreenshotFolderPanel.swift b/Peel/Model/ScreenshotFolderPanel.swiftindex cdbf488e..6da99969 100644--- a/Peel/Model/ScreenshotFolderPanel.swift+++ b/Peel/Model/ScreenshotFolderPanel.swift@@ -2,17 +2,22 @@ import AppKitimport PeelCore/// The open panel for the screenshot folder. It is the panel's delegate, so a folder screenshots can't be saved in is-/// refused while the panel stays open, with the reason. The panel holds its delegate weakly, and `choose()` running-/// on this object keeps it alive.+/// refused while the panel stays open, with the reason.final class ScreenshotFolderPanel: NSObject, NSOpenSavePanelDelegate {- func choose() async -> URL? {+ private override init() {}++ static func choose() async -> URL? {+ let delegate = ScreenshotFolderPanel()let panel = NSOpenPanel()panel.canChooseDirectories = truepanel.canChooseFiles = falsepanel.prompt = String(localized: "Choose")panel.message = String(localized: "Where should screenshots be saved?")- panel.delegate = self- return await panel.begin() == .OK ? panel.url : nil+ panel.delegate = delegate+ let chosen = await panel.begin() == .OK ? panel.url : nil+ // The panel holds its delegate weakly: this keeps it until the panel has closed.+ extendLifetime(delegate)+ return chosen}func panel(_ sender: Any, validate url: URL) throws {diff --git a/Peel/Model/TweakLibrary.swift b/Peel/Model/TweakLibrary.swiftindex bd0e5571..ed3610c3 100644--- a/Peel/Model/TweakLibrary.swift+++ b/Peel/Model/TweakLibrary.swift@@ -117,7 +117,7 @@ final class TweakLibrary {func chooseScreenshotFolder(for tweak: Tweak) async {// Asked again once the panel has closed, since the folder can change after the panel's own check.- guard let url = await ScreenshotFolderPanel().choose(), ScreenshotFolder.problem(with: url) == nil+ guard let url = await ScreenshotFolderPanel.choose(), ScreenshotFolder.problem(with: url) == nilelse { return }await turnOn(tweak, text: url.path(percentEncoded: false))}