From 5d1c95621b86eaed664a6ad2f58b234a0d161376 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 6 Feb 2021 15:31:13 -0500 Subject: [PATCH] Fix VisualEffectImageButton retain cycle Button had a menu which had an action which had a closure which strongly referenced the sourceView which was the button itself. --- Tusker/Screens/Utilities/Previewing.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tusker/Screens/Utilities/Previewing.swift b/Tusker/Screens/Utilities/Previewing.swift index d1995c61..9418c84c 100644 --- a/Tusker/Screens/Utilities/Previewing.swift +++ b/Tusker/Screens/Utilities/Previewing.swift @@ -40,7 +40,7 @@ extension MenuPreviewProvider { guard mastodonController.loggedIn else { return [ openInSafariAction(url: account.url), - createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self] (_) in + createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self, weak sourceView] (_) in guard let self = self else { return } self.navigationDelegate?.showMoreOptions(forAccount: accountID, sourceView: sourceView) }) @@ -89,7 +89,7 @@ extension MenuPreviewProvider { let shareSection = [ openInSafariAction(url: account.url), - createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self] (_) in + createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self, weak sourceView] (_) in guard let self = self else { return } self.navigationDelegate?.showMoreOptions(forAccount: accountID, sourceView: sourceView) }) @@ -104,7 +104,7 @@ extension MenuPreviewProvider { func actionsForURL(_ url: URL, sourceView: UIView?) -> [UIAction] { return [ openInSafariAction(url: url), - createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self] (_) in + createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self, weak sourceView] (_) in guard let self = self else { return } self.navigationDelegate?.showMoreOptions(forURL: url, sourceView: sourceView) }) @@ -139,7 +139,7 @@ extension MenuPreviewProvider { guard mastodonController.loggedIn else { return [ openInSafariAction(url: status.url!), - createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self] (_) in + createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self, weak sourceView] (_) in guard let self = self else { return } self.navigationDelegate?.showMoreOptions(forStatus: status.id, sourceView: sourceView) }) @@ -190,7 +190,7 @@ extension MenuPreviewProvider { var shareSection = [ openInSafariAction(url: status.url!), - createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self] (_) in + createAction(identifier: "share", title: "Share...", systemImageName: "square.and.arrow.up", handler: { [weak self, weak sourceView] (_) in guard let self = self else { return } self.navigationDelegate?.showMoreOptions(forStatus: status.id, sourceView: sourceView) }),