Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Swift Concurrency (async/await) #299

Closed
ondrejkorol opened this issue Apr 1, 2023 · 4 comments
Closed

Support for Swift Concurrency (async/await) #299

ondrejkorol opened this issue Apr 1, 2023 · 4 comments

Comments

@ondrejkorol
Copy link

What are you trying to achieve?

In our codebase, we try to leverage the latest Swift features. For asynchronous calls, we're using the new Swift concurrency framework. I see that currently, Stream Chat SDK doesn't provide async/await methods. The same goes for @ MainActor support.
As a result, we sometimes have issues connecting the rest of the codebase with Stream Chat.

Are there any plans regarding supporting Swift Concurrency?:)

If possible, how can you achieve this currently?

Currently, we can bridge completion handlers with the native APIs like withChecked(Throwing)Continuation etc. But still, there are some parts, like the handling of MainActor, that need compromises (nonisolated keywords, DispatchQueue.async.main etc)

What would be the better way?

  • Provide async/await methods for asynchronous calls
  • Mark UI-related classes as @ MainActor(ViewFactory)

GetStream Environment

GetStream Chat version: 4.29.0
GetStream Chat frameworks: StreamChat, StreamChatSwiftUI
iOS version: 15+
Swift version: 5
Xcode version: 14.2

@martinmitrevski
Copy link
Contributor

Hi @ondrejkorol,

Thanks for reporting this. Yes, we have plans to add support for Swift Concurrency, first for StreamChat (exposing async/await methods), and then for the SwiftUI SDK.

The ETA is end by the end of Q2 (if we don't have any unplanned change of priorities).

We will update you on this ticket when this is available.

Best, Martin

@paulz
Copy link

paulz commented Apr 14, 2023

would love to see async support, as we build new iOS16+ app

@martinmitrevski
Copy link
Contributor

Since the release 4.56.0, we have a new state layer that supports Swift Concurrency: https://getstream.io/chat/docs/sdk/ios/client/state-layer/state-layer-overview/. Let us know what you think.

@ondrejkorol
Copy link
Author

That's amazing! I'll be happy to try it out. Great work! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants