ThreadedMessages is a Composite Component that displays all replies made to a particular message in a conversation. By default, the parent message will be displayed at the top, the message composer will be at the bottom and between them a message list will contain all replies.
ThreadedMessages is composed of the following components:
As CometChatThreadedMessages is a view controller, you can launch it by adding the following code snippet.
Swift
Report incorrect code
Copy
Ask AI
let threadedMessage = CometChatThreadedMessages()
Ensure to pass and present threadedMessage. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.
Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.ThreadedMessages does not have its own actions. However, you can override the behavior of the ThreadedMessages component by using the actions of its Components, with the help of Configurations.ExampleIn this example, we are overriding the setOnThreadRepliesClick of the MessageList Component using MessageListConfiguration and applying it to ThreadedMessages.
Swift
Report incorrect code
Copy
Ask AI
let messageListConfiguration = MessageListConfiguration() .setOnThreadRepliesClick { message, messageBubbleView in // Perform your action }let threadedMessageConfiguration = ThreadedMessageConfiguration() .set(messageListConfiguration: messageListConfiguration)let cometChatMessages = CometChatMessages() .set(user: user) .set(threadedMessageConfiguration: threadedMessageConfiguration)
Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.ThreadedMessages does not have its own Filters. However, you can filter the messages list in ThreadedMessages Component using MessageListConfiguration.ExampleIn this example, we are filtering messages and searching for messages that contain the keyword “payment”.
Events are emitted by a Component. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.The MessageList Component does not emit any events of its own.
To fit your app’s design requirements, you can customize the appearance of the conversation component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
List of properties available for configuring in ThreadedMessagesStyle:
Property
Description
Code
doneButtonTextColor
allows to modify the color of the text in the done button. Defaults to CometChatTheme.palatte.primary.
.set(doneButtonTextColor:UIColor)
doneButtonTextFont
allows to modify the font of the text in the done button
.set(doneButtonTextFont:UIFont)
background
Used to customize the background color. Defaults to CometChatTheme.palatte.background.
.set(background:UIColor)
actionItemTitleFont
allows to modify the font of the title in the action item view
.set(actionItemTitleFont:UIFont)
actionItemTitleColor
allows to modify the color of the title in the action item view
.set(actionItemTitleColor:UIColor)
bubbleViewBackgroundColor
Used to set background color of the bubble view for a message that has been received or a message other than text that has been sent . Defaults to CometChatTheme.palatte.background.
.set(bubbleViewBackgroundColor:UIColor)
bubbleViewPrimaryBackgroundColor
Used to set background color of the bubble view for a text message that has been sent. Defaults to CometChatTheme.palatte.primary.
.set(bubbleViewPrimaryBackgroundColor:UIColor)
bubbleViewSecondaryBackgroundColor
Used to set background color of the bubble view for a message that has been received or a message other than text that has been sent. Defaults to CometChatTheme.palatte.secondary.
.set(bubbleViewSecondaryBackgroundColor:UIColor)
actionItemBackgroundColor
allows to modify the background color of the action item view. Defaults to CometChatTheme.palatte.background.
For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.
In this example, we will set styling to message bubble view which we get from setOnThreadRepliesClick Action of MessageList Component and apply custom styles on it.
Configurations offer the ability to customize the properties of each individual component within a Composite Component.The ThreadedMessages is a Composite Component, and it has a distinct set of configurations for each of its components as follows.
If you want to customize the properties of the MessageList Component inside ThreadedMessages Component, you need use the MessageListConfiguration object.
Swift
Report incorrect code
Copy
Ask AI
let messageListConfiguration = MessageListConfiguration()let threadedMessageConfiguration = ThreadedMessageConfiguration() .set(messageListConfiguration: messageListConfiguration)
Please note that the Properties marked with the symbol are not accessible within the Configuration Object.
Example
In this example, we will be changing the list alignment and modifying the message bubble styles in the MessageList component using MessageListConfiguration.
If you want to customize the properties of the MessageComposer Component inside ThreadedMessages Component, you need use the MessageComposerConfiguration object.
Swift
Report incorrect code
Copy
Ask AI
let messageComposerConfiguration = MessageComposerConfiguration()let cometChatMessages = CometChatMessages() .set(messageComposerConfiguration: messageComposerConfiguration)
Please note that the Properties marked with the symbol are not accessible within the Configuration Object.
Example
In this example, we’ll be adding a custom header view and customizing some properties of the MessageComposer component using MessageComposerConfiguration.