Skip to content

Multiple swiftUI instances with different ChatClients #817

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

Closed
GregoryBeresfordBrown opened this issue Apr 25, 2025 · 1 comment
Closed

Comments

@GregoryBeresfordBrown
Copy link

What are you trying to achieve?

Multiple SwiftUI instances bound to separate chat clients

If possible, how can you achieve this currently?

It's not possible to achieve due to the ridiculous self registration pattern of StreamChat for injection. That instance then holds a specific chat client that would be used by all views.

What would be the better way?

Pass StreamChat to the view constructor

GetStream Environment

Not relevant

Additional context

@martinmitrevski
Copy link
Contributor

Hi,

We don't support multiple chat client instances at the same time. If you logout from the first client, you should clean up all the SwiftUI views that keep the previous instance.

Potentially, you could also have a leak somewhere.

Hope that helps, Martin

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

2 participants