How do you go from completionHandler to async / await? 🤔

Поделиться
HTML-код
  • Опубликовано: 6 ноя 2024

Комментарии • 10

  • @v_pradeilles
    @v_pradeilles  3 года назад +5

    Did you find this tip useful? Are you planning on using it in your apps? Let me know in the comments 🚀

    • @dr.shrimppuertorico7467
      @dr.shrimppuertorico7467 3 года назад +2

      Yes, love your quick to the point videos.

    • @waheedafolabi6929
      @waheedafolabi6929 3 года назад

      It's very useful and even though I don't have a use case for it at the moment, it's saved in my playlist for easy reference.

  • @poesalec3330
    @poesalec3330 3 года назад +3

    How do I use async funtions in my app? When I have an async function getUsers which returns an array of users, how do I use that in my UIButton actions or viewDidLoad?

    • @v_pradeilles
      @v_pradeilles  3 года назад +2

      That's a good question! Short answer: you need to use the global `async()` function.
      There's a more detailed explanation in this article 👉 wwdcbysundell.com/2021/calling-async-apis-from-synchronous-contexts/

  • @waheedafolabi6929
    @waheedafolabi6929 3 года назад

    Thanks for the great content you are providing. I wondered why it took me so long to discover your channel.
    What's required to be an SDK developer?
    Could you build a full app where you show your thought process with implementation of SOLID principle and clean code architecture?

  • @developerios6096
    @developerios6096 3 года назад

    I wont negate (for me at least) this approach comes with additional complexity, or maybe its just because we are not confident with this new approach.
    I do understand some of the closure drawbacks, like retain cycles, pyramids of doom(which really destroy readability), but to me, if you have an easy task(i mean no complex, short amount of code) completion could still be considered the way to go. What you think Vincent? Would you replace all your completion based functions to follow this new approach?
    Good video anyway, you managed to handle the complexity making it a bit easier

    • @v_pradeilles
      @v_pradeilles  3 года назад +2

      Honestly I think Apple will push this pattern so much in their code examples and tutorials that it will become the norm in a couple of years.
      I agree that for the "simple" use case completionHandlers are quite nice, however they don't scale well and we know by experience that "simple" use case always tend to become more complex over the lifetime of a project...

  • @teamdjamodjamo2523
    @teamdjamodjamo2523 3 года назад

    J’adore l’accent français!!!

    • @jaqb17
      @jaqb17 3 года назад

      clousure