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.
This commit is contained in:
Shadowfacts 2021-02-06 15:31:13 -05:00
parent 02ba45fa34
commit 5d1c95621b
1 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ extension MenuPreviewProvider {
guard mastodonController.loggedIn else { guard mastodonController.loggedIn else {
return [ return [
openInSafariAction(url: account.url), 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 } guard let self = self else { return }
self.navigationDelegate?.showMoreOptions(forAccount: accountID, sourceView: sourceView) self.navigationDelegate?.showMoreOptions(forAccount: accountID, sourceView: sourceView)
}) })
@ -89,7 +89,7 @@ extension MenuPreviewProvider {
let shareSection = [ let shareSection = [
openInSafariAction(url: account.url), 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 } guard let self = self else { return }
self.navigationDelegate?.showMoreOptions(forAccount: accountID, sourceView: sourceView) self.navigationDelegate?.showMoreOptions(forAccount: accountID, sourceView: sourceView)
}) })
@ -104,7 +104,7 @@ extension MenuPreviewProvider {
func actionsForURL(_ url: URL, sourceView: UIView?) -> [UIAction] { func actionsForURL(_ url: URL, sourceView: UIView?) -> [UIAction] {
return [ return [
openInSafariAction(url: url), 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 } guard let self = self else { return }
self.navigationDelegate?.showMoreOptions(forURL: url, sourceView: sourceView) self.navigationDelegate?.showMoreOptions(forURL: url, sourceView: sourceView)
}) })
@ -139,7 +139,7 @@ extension MenuPreviewProvider {
guard mastodonController.loggedIn else { guard mastodonController.loggedIn else {
return [ return [
openInSafariAction(url: status.url!), 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 } guard let self = self else { return }
self.navigationDelegate?.showMoreOptions(forStatus: status.id, sourceView: sourceView) self.navigationDelegate?.showMoreOptions(forStatus: status.id, sourceView: sourceView)
}) })
@ -190,7 +190,7 @@ extension MenuPreviewProvider {
var shareSection = [ var shareSection = [
openInSafariAction(url: status.url!), 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 } guard let self = self else { return }
self.navigationDelegate?.showMoreOptions(forStatus: status.id, sourceView: sourceView) self.navigationDelegate?.showMoreOptions(forStatus: status.id, sourceView: sourceView)
}), }),