0

I have a swiftui app and trying to integrate the Stream Chat SDK. I have been able to successfully log a user in, but having difficulty creating a channel and the documentation is quite challenging to work with to understand the issue. Here is my code to create a hardcoded "general" channel:

class ChatManager: ObservableObject {

// vars and other methods

    public func createNewChannel(name: String) {
        
        do {
            let channelId = ChannelId(type: .messaging, id: "general")
            let channelController = try chatClient.channelController(
                createChannelWithId: channelId,
                name: name,
                members: [],
                isCurrentUserMember: true
            )
            channelController.synchronize { error in
                if let error = error {
                    print(error)
                }
            }
            
        } catch {
            print(error)
        }
    
    } 
}

The usage of this function is just a button that triggers it.

Here is my ChannelListView:

struct ChannelListView: View {
    @EnvironmentObject var chatManager: ChatManager
    
    var body: some View {
        ChatChannelListView(
            viewFactory: CustomFactory.shared,
            channelListController: chatManager.customChannelListController
        )
    }
}

class CustomFactory: ViewFactory {

    @Injected(\.chatClient) public var chatClient

    private init() {}

    public static let shared = CustomFactory()

    func makeNoChannelsView() -> some View {
        VStack {
            Text("This is our own custom no channels view.")
        }
    }

}

The error code get's printed repeatedly after I tap the button. Here is the error code I'm getting:

2023-08-31 09:28:09.799 [ERROR] [com.apple.root.default-qos] [APIClient.swift:223] [executeRequest(endpoint:completion:)] > Error WaiterTimeout in /Users/username/Library/Developer/Xcode/DerivedData/project_name/SourcePackages/checkouts/stream-chat-swift/Sources/StreamChat/Utils/Timers.swift:54

Thanks for your help!

0 Answers0