Thread

The ChatThreadVC is very similar with the ChatChannelVC, the difference is that instead of displaying messages, it displays the replies of a message thread. Just like the ChatChannelVC it also contains the ComposerVC component to create new replies.

The following diagram shows the components hierarchy of ChatThreadVC:

Digraph

Overview

  • ChatThreadHeaderView is responsible to display the thread information in the navigationItem.titleView.
  • ChatMessageListVC is the component that handles the rendering of the replies.
  • ComposerVC is the component that handles the creation of new replies.

Usage

By default, the ChatThreadVC is created when you click to see the replies of a message in the ChatMessageListVC component. But in case you want to create it programmatically, you can use the following code:

let cid = "channel-id"
let messageId = "message-id"
let threadVC = ChatThreadVC()
threadVC.channelController = ChatClient.shared.channelController(for: cid)
threadVC.messageController = ChatClient.shared.messageController(
    cid: cid,
    messageId: messageId
)

navigationController?.show(threadVC, sender: self)

In this section we are going to use ChatClient as a singleton, you can find more information about that here

UI Customization

You can customize how the ChatThreadVC looks by subclassing it and swap the component in Components configuration:

Components.default.threadVC = CustomChatThreadVC.self

You can find more information on how the components configuration works here.

Just like the ChatChannelVC, the ChatThreadVC is only responsible for composing the ChatThreadHeaderView, ChatMessageListVC and ChatMessageComposerVC components together. In case you want to customize the rendering of the replies, you should read the Message documentation.

© Getstream.io, Inc. All Rights Reserved.