-
Notifications
You must be signed in to change notification settings - Fork 31
Remove strong references of self in closures #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove strong references of self in closures #765
Conversation
| lazy var imageEditorToggle: UISegmentedControl = { | ||
| let control = UISegmentedControl(items: [ | ||
| UIAction.init(title: "Default Image Editor") { _ in self.useCustomImageEditor = false }, | ||
| UIAction.init(title: "Custom Image Editor") { _ in self.useCustomImageEditor = true }, | ||
| UIAction.init(title: "Default Image Editor") { [weak self] _ in self?.useCustomImageEditor = false }, | ||
| UIAction.init(title: "Custom Image Editor") { [weak self] _ in self?.useCustomImageEditor = true }, | ||
| ]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are an extra retention on DemoQuickEditorViewController
| true | ||
| } set: { isPresented in | ||
| } set: { [weak self] isPresented in | ||
| Task { @MainActor in | ||
| guard !isPresented else { return } | ||
| self.dismiss(animated: true) | ||
| self.onDismiss?() | ||
| self?.dismiss(animated: true) | ||
| self?.onDismiss?() | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the main culprit
|
| App Name | Gravatar Prototype Build | |
| Build Number | 2385 | |
| Version | PR #765 | |
| Bundle ID | com.automattic.gravatar-sdk-demo-uikit.prototype-build | |
| Commit | d08b5e9 | |
| Installation URL | 3fqucm57gdm20 |
| func updateDetents() { | ||
| if let sheet = sheetPresentationController { | ||
| sheet.animateChanges { | ||
| sheet.animateChanges { [weak self] in | ||
| guard let self else { return } | ||
| sheet.detents = QEDetent.detents( | ||
| for: scopeOption, | ||
| intrinsicHeight: sheetHeight, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This I think is doing nothing 🤔
`.assign(to: \.shouldDisplayNoSelectedAvatarWarning, on: self)` captures self strongly
pinarol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉

Closes #
Description
This PR fixes a retain cycle on
QuickEditorViewController, and inDemoQuickEditorViewControllerTesting Steps
QuickEditorViewController,InnerHeightUIHostingController, orDemoQuickEditorViewControllerin the graph.