-
Notifications
You must be signed in to change notification settings - Fork 37
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
Completion handler being called immediately... #18
Comments
it would seem i misunderstood the "completion" portion of the signature, and was thinking async. It really should be renamed "didAppear" as it surely isn't a completed showing of a popup. I know this is not the repo's issue, but a swift thing. |
@wdcurry |
I don’t think you understood my point and follow up. I was expecting the completion to act as the completion of the presention, ie when the pop up was finished, not to when it was completed in instantion and now showing. In the context of passing control to a pseudo-modal view, the current logic from Apple is incorrect. The completion should run when the pop up disappears. |
@wdcurry Hello, I think we have different point of view. https://developer.apple.com/documentation/uikit/uiviewcontroller/1621380-present func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool,
completion: (() -> Void)? = nil)
https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss func dismiss(animated flag: Bool,
completion: (() -> Void)? = nil)
Therefore, If you want to run the closure after the pop up disappears on screen, you can use public func dismissPopover(animated: Bool, completion: DismissPopoverCompletion?) |
Thank you for taking the time to explain that so well. This is/was my first foray into the popOver, and indeed my wires were crossed. I had already gone old-school with an unwind as i usually do, but will convert to the block passing as time permits, thanks! |
You can see this in the demo, by breaking any of the completion handlers and running the example. You can seem them called immediately, which great negates the ease-of-use factor if collecting info.
The text was updated successfully, but these errors were encountered: