⚠️ 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.
@LucasAbijmil3 жыл бұрын
Once again great topic, amazing content. Thanks Vincent!
@KK-pq6lu3 жыл бұрын
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.
@v_pradeilles3 жыл бұрын
Good idea!
@EmmaKAlexandra3 жыл бұрын
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-pq6lu3 жыл бұрын
Doesn’t follow the principle of separation of concerns. They really should have a separate modifier to hold/retain the reference.
@조요한-y1e Жыл бұрын
Wow ! migration to my project now.
@andybezaire3 жыл бұрын
Another great video. 🚀🚀🚀 Question: Why did you choose for NumberGenerator to be a class instead of a struct?
@poluxsaurus14543 жыл бұрын
I think it’s because it manages a Timer therefore it needs to be able to mutate itself.
@randomdoodler3 жыл бұрын
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_pradeilles3 жыл бұрын
Good point! Yes of course, in a real app I would definitely recommend introducing a few model later such as the one you described 👍