Meet the new alternative to Combine's Publisher! (it's called AsyncStream)

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

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

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

    ⚠️ I forgot an important piece of information! AsyncStream will be back ported to iOS 13 in Xcode 13.2, which is currently in beta. So right now if you use Xcode's latest stable version (Xcode 13.1), you'll notice that AsyncStream is iOS 15 only, and that's totally normal.

  • @LucasAbijmil
    @LucasAbijmil 2 года назад +2

    Once again great topic, amazing content. Thanks Vincent!

  • @KK-pq6lu
    @KK-pq6lu 2 года назад +2

    Would be nice to have a follow on video, starting with the code you have in this video, to add a button to stop the number generator - to show cleanest way how to suspend or even end a task.

  • @EmmaKAlexandra
    @EmmaKAlexandra 2 года назад +1

    Pretty cool. Only being able to retain the generator because of the onTermination closure is pretty weird. Rust handles this kind of pattern using `move` to give ownership of a variable into a new context. Seems like it might be handy in Swift!

    • @KK-pq6lu
      @KK-pq6lu 2 года назад

      Doesn’t follow the principle of separation of concerns. They really should have a separate modifier to hold/retain the reference.

  • @조요한-y1e
    @조요한-y1e Год назад

    Wow ! migration to my project now.

  • @andybezaire
    @andybezaire 2 года назад

    Another great video. 🚀🚀🚀 Question: Why did you choose for NumberGenerator to be a class instead of a struct?

    • @poluxsaurus1454
      @poluxsaurus1454 2 года назад

      I think it’s because it manages a Timer therefore it needs to be able to mutate itself.

  • @randomdoodler
    @randomdoodler 2 года назад

    Great video! I saw that you use the async stream in a task closure in the content view struct. Ideally we don’t want too much logic in the view. Nice thing about Combine is that all the observation logic can go into an ObservableObject class and it writes into a @Published var, and view just has to display that published var from the @ObservedObject. Can async/await do the same? (Let the for await code be in a separate class and the view just displays a var without having any observation logic)

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

      Good point! Yes of course, in a real app I would definitely recommend introducing a few model later such as the one you described 👍

  • @dev_jeongdaeri
    @dev_jeongdaeri 2 года назад

    Holymoly!!! 😭👍