Code Monkey home page Code Monkey logo

Comments (5)

wdcurry avatar wdcurry commented on May 13, 2024 1

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!

from kuipopover.

wdcurry avatar wdcurry commented on May 13, 2024

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.

from kuipopover.

Kofktu avatar Kofktu commented on May 13, 2024

@wdcurry
When calling the UIViewController's presenter, pass completion to the parameter.
It's the same as the iOS system.

from kuipopover.

wdcurry avatar wdcurry commented on May 13, 2024

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.

from kuipopover.

cozzin avatar cozzin commented on May 13, 2024

@wdcurry Hello, I think we have different point of view.
In UIKit, The completion closure of the present function is called when the present animation ends. In the same way, the dismiss function also calls the completion closure when the dismiss animation finishes.

https://developer.apple.com/documentation/uikit/uiviewcontroller/1621380-present

func present(_ viewControllerToPresent: UIViewController, 
    animated flag: Bool, 
  completion: (() -> Void)? = nil)

completion
The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter.

https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss

func dismiss(animated flag: Bool, 
  completion: (() -> Void)? = nil)

completion
The block to execute after the view controller is dismissed. This block has no return value and takes no parameters. You may specify nil for this parameter.

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?)

from kuipopover.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.