Closed ghost closed 6 years ago
Hey there! The completion is indeed called whenever the dialog is dismissed. As the handler is called on deinit, my guess is that deinit is not called. This can be caused by a retain cycle. Do you have a small example project I can check out?
Thanks!
Reference to the popup dialog was stored in a variable due to which the popup dialog did not get deinited and handler did not get called.
After making the reference weak, the handler gets called.
Report
Environment
Please provide information on your development environment, so we can build with the same scenario.
Dependency management
If you are not using any dependency managers, you can remove this section.
What did you do?
I am showing a popup dialog box using the following code
The dialog box is shown as expected.
If I click on the background, the dialog box disappears as expected.
What did you expect to happen?
After I click on the background, the dialog box disappears as expected. Since I have provided the
completion
parameter, I expected that the completion handler will be executed anddialog was dimissed
will be printed to consoleWhat happened instead?
The
completion
handler is not executed.Additional Information
According to this PR, completion handler is executed when popup is deinited.
The readme says
This completion handler is called when the dialog was dismissed. This is especially useful for catching a gesture dismissal
Is there any way to catch a gesture dismissal without deiniting the popup