You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(the method for getting the channel (btw. why is there no get method for a channel in the state layer?)):
func getDirectChannel(for userIds: Set<String>) throws -> Chat {
// Retrieve the chat from the dictionary
if let chat = chatChannels[userIds] {
return chat
} else {
throw ChatError.channelCreationFailed // or handle the error as needed
}
}
The messages are not re-rendered. Even though they are marked as @Published (@Published public internal(set) var messages = StreamCollection<ChatMessage>([])) in the ChatState.swift file @MainActor public final class ChatState: ObservableObject
I also checked that the messages are received, both on the channel by subscribing to events and by placing a breakpoint on the internal observer the ChatState creates (line 207) messagesDidChange: { [weak self] in self?.messages = $0 }. I can confirm all events are received.
I am aware the documentation available uses Combine but that is outdated and ugly. The @Published property hints that the view should automatically re-render, which would be awesome.
Could anyone point me to what I am doing wrong?
The text was updated successfully, but these errors were encountered:
What did you do?
(the method for getting the channel (btw. why is there no get method for a channel in the state layer?)):
ChatRoomView
:What did you expect to happen?
The list re-renders as new messages arrive.
What happened instead?
The messages are not re-rendered. Even though they are marked as
@Published
(@Published public internal(set) var messages = StreamCollection<ChatMessage>([])
) in theChatState.swift
file@MainActor public final class ChatState: ObservableObject
I also checked that the messages are received, both on the channel by subscribing to events and by placing a breakpoint on the internal observer the
ChatState
creates (line 207)messagesDidChange: { [weak self] in self?.messages = $0 }
. I can confirm all events are received.GetStream Environment
GetStream Chat version: 4.67.0
GetStream Chat frameworks: None, custom UI
iOS version: 18.0
Swift version: 5.9
Xcode version: 16.1
Device: iPhone 13 mini, iPhone 16 Pro (Simulator)
Additional context
I am aware the documentation available uses Combine but that is outdated and ugly. The
@Published
property hints that the view should automatically re-render, which would be awesome.Could anyone point me to what I am doing wrong?
The text was updated successfully, but these errors were encountered: