We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello, I have found a problem of reference cycle between FABMenu and FABMenuController.
FABMenuController has a reference to FABMenu:
open class FABMenuController: RootController { open let fabMenu = FABMenu() }
FABMenu has references to FABMenuController via the 4 callbacks:
extension FABMenuController { fileprivate func prepareFABMenu() { ... fabMenu.handleFABButtonCallback = handleFABButtonCallback fabMenu.handleOpenCallback = handleOpenCallback fabMenu.handleCloseCallback = handleCloseCallback fabMenu.handleCompletionCallback = handleCompletionCallback } }
One way to avoid this is to use weak references in the callbacks:
fabMenu.handleFABButtonCallback = { [weak self] button in self?.handleFABButtonCallback(button: button) } fabMenu.handleOpenCallback = { [weak self] in self?.handleOpenCallback() } fabMenu.handleCloseCallback = { [weak self] in self?.handleCloseCallback() } fabMenu.handleCompletionCallback = { [weak self] view in self?.handleCompletionCallback(view: view) }
This did fix the problem in my case.
Am I correct or am I missing something? Do you see better ways to solve this problem?
Thanks.
The text was updated successfully, but these errors were encountered:
I will take a look, nice catch :)
Sorry, something went wrong.
thanks @DanielDahan ;)
@comaxime For now, your solution looks great :) I am going to make a push now. All the best!
daniel-jonathan
No branches or pull requests
Hello,
I have found a problem of reference cycle between FABMenu and FABMenuController.
FABMenuController has a reference to FABMenu:
FABMenu has references to FABMenuController via the 4 callbacks:
One way to avoid this is to use weak references in the callbacks:
This did fix the problem in my case.
Am I correct or am I missing something?
Do you see better ways to solve this problem?
Thanks.
The text was updated successfully, but these errors were encountered: