Closed f3dm76 closed 1 week ago
Hi @f3dm76,
That method won't ever fail unless you use the channelController(createChannelWithId:)
.
The only way it can fail is in the synchronize
method, and in that case, you need to handle the error. To handle this error, if you are using our UI components, you need to override the ChatChannelVC.didFinishSynchronizing(error:)
function.
Thank you, Nuno
Hey @nuno-vieira, thank you for your answer, yes I'm using StreamChat's UI components, but the SwiftUI one. I'd like to avoid UIView representable, is there a way to do in it in pure SwiftUI? Have a great day!
What are you trying to achieve?
I'm trying to get the error during channel fetching. chatClient.channelController(for: ChannelId(type: .messaging, id: $0.chatID.lowercased())) For example the channel with this id could not be created yet or something happened during fetching. And I want to noramlly process this state, asking the user to wait or something.
Why do I want this?
Sometimes it happens right after you connect with someone you tap to go into the chat and it’s just a loading spinner. So I think it might be something going wrong inside the chat controller
If possible, how can you achieve this currently?
What would be the better way?
make channelController a throwing method, and allow the programmer to catch a readable error
GetStream Environment
GetStream Chat version: 4.62.0 GetStream Chat frameworks: StreamChat, StreamChatUI iOS version: 18.0 Swift version: 6.0 Xcode version: 16.0 Device: sim iPhone 16 pro max
Additional context