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

Add ability to change filter on ChannelList in the state layer #676

Open
vojtabohm opened this issue Dec 3, 2024 · 0 comments
Open

Add ability to change filter on ChannelList in the state layer #676

vojtabohm opened this issue Dec 3, 2024 · 0 comments

Comments

@vojtabohm
Copy link

vojtabohm commented Dec 3, 2024

What are you trying to achieve?

I want to display a channel list with some filtering options:
Simulator - 2024-12-03 at 15 33 44@2x

Searching, filtering unreads and group chats.

If possible, how can you achieve this currently?

I need to create a ChatChannelListController and use synchronize and delegates, wrap it in a viewmodel and expose it to my custom SwiftUI view using @Published. Which is not ideal given that StreamChat provides a state layer promising async/await and observation.

What would be the better way?

ChannelList in the state layer should have some method like updateFilter that would refresh the query, the same way ChatChannelListController does it. So we could use modern async/await + @Published and re-render views automatically when filtering changes.

I tried to create a wrapper viewmodel class that would just create queries and channels based on filter and then just call .get() whenever the filter changes. But that stops realtime updates for some reason.

GetStream Environment

GetStream Chat version: 4.67.0
GetStream Chat frameworks:
iOS version: 18.0
Swift version: 5.9
Xcode version: 15.1
Device: iPhone 16 Simulator

Additional context

Maybe I am doing something wrong but I don't know how to approach this using ChannelList

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

1 participant