should I use async. streams for combine
Asked on 08/03/2024
1 search
Yes, you should consider using async streams for Combine when dealing with asynchronous sequences. Async streams can make your UI feel more responsive by streaming results as they become available, similar to an async sequence. This approach is particularly useful when you want to reflect the first result in your UI right away, rather than waiting for all results to be ready.
For example, in the session Meet the Translation API, it is mentioned that streaming results as they become available can make your UI more responsive. This is akin to using async sequences in Swift, which can be efficiently managed using async streams in Combine.
Additionally, the session Explore Swift performance discusses how async functions are implemented and managed in Swift, which can provide further insights into how async streams can be beneficial for performance and responsiveness in your applications.
Relevant Sessions

Discover Swift enhancements in the Vision framework
The Vision Framework API has been redesigned to leverage modern Swift features like concurrency, making it easier and faster to integrate a wide array of Vision algorithms into your app. We’ll tour the updated API and share sample code, along with best practices, to help you get the benefits of this framework with less coding effort. We’ll also demonstrate two new features: image aesthetics and holistic body pose.

Explore Swift performance
Discover how Swift balances abstraction and performance. Learn what elements of performance to consider and how the Swift optimizer affects them. Explore the different features of Swift and how they’re implemented to further understand the tradeoffs available that can impact performance.

Meet the Translation API
Discover how you can translate text across different languages in your app using the new Translation framework. We’ll show you how to quickly display translations in the system UI, and how to translate larger batches of text for your app’s UI.