CometChatMessageList component displays a scrollable list of messages in a conversation. It supports text messages, media messages, reactions, threads, and real-time updates for new messages, edits, and deletions.

AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Component | CometChatMessageList |
| Package | CometChatUIKitSwift |
| Inherits | UIViewController |
Where It Fits
CometChatMessageList is the core component for displaying messages in a chat. It’s typically used within CometChatMessages alongside CometChatMessageHeader and CometChatMessageComposer.

Minimal Render

Filtering
UseMessagesRequest.MessageRequestBuilder to filter which messages appear in the list. The builder pattern allows chaining multiple filter conditions.
Filter Recipes
| Recipe | Code |
|---|---|
| Text messages only | .set(types: ["text"]) |
| Media messages only | .set(types: ["image", "video", "audio", "file"]) |
| Search by keyword | .set(searchKeyword: "hello") |
| Limit results | .set(limit: 50) |
| Messages after timestamp | .set(timestamp: 1234567890) |
| Hide deleted messages | .hideDeletedMessages(true) |
| Specific categories | .set(categories: ["message", "custom"]) |
Actions and Events
Callback Props
onThreadRepliesClick
Fires when a user taps on the thread indicator of a message bubble.onReactionClick
Fires when a user taps on a reaction on a message bubble.onReactionListItemClick
Fires when a user taps on a specific reaction in the reaction list.onError
Fires when an error occurs while loading messages.onEmpty
Fires when the message list is empty.onLoad
Fires when messages are successfully loaded.Actions Reference
| Method | Description | Example |
|---|---|---|
set(onThreadRepliesClick:) | Triggered when thread indicator is tapped | Open thread view |
set(onReactionClick:) | Triggered when a reaction is tapped | Show reaction details |
set(onReactionListItemClick:) | Triggered when reaction list item is tapped | Show who reacted |
set(onError:) | Triggered when an error occurs | Show error alert |
set(onEmpty:) | Triggered when list is empty | Show empty state |
set(onLoad:) | Triggered when messages load | Analytics tracking |
scrollToBottom(isAnimated:) | Scrolls to the bottom of the list | Navigate to latest |
goToMessage(withId:) | Scrolls to a specific message | Jump to message |
SDK Events (Real-Time, Automatic)
| SDK Listener | Internal behavior |
|---|---|
onMessageReceived | Adds new message to the list |
onMessageEdited | Updates the edited message in place |
onMessageDeleted | Removes or marks message as deleted |
onTypingStarted | Shows typing indicator |
onTypingEnded | Hides typing indicator |
onMessageReactionAdded | Updates reaction count on message |
onMessageReactionRemoved | Updates reaction count on message |
Data Manipulation Methods
Programmatically manage messages in the list using these methods.add(message:)
Adds a new message to the message list.| Parameter | Type | Description |
|---|---|---|
message | BaseMessage | The message to add to the list |
update(message:)
Updates an existing message in the list.| Parameter | Type | Description |
|---|---|---|
message | BaseMessage | The message with updated content |
remove(message:)
Removes a message from the list without deleting it from the server.| Parameter | Type | Description |
|---|---|---|
message | BaseMessage | The message to remove from the list |
delete(message:)
Deletes a message from both the list and the server.| Parameter | Type | Description |
|---|---|---|
message | BaseMessage | The message to delete |
clearList()
Removes all messages from the list.isEmpty()
Checks if the message list is empty.Connection Management
Manually control the WebSocket connection for the message list.connect()
Establishes the WebSocket connection for real-time updates. Use this when you need to manually reconnect after disconnecting.disconnect()
Disconnects the WebSocket connection. Use this when you want to temporarily stop receiving real-time updates, such as when the view is not visible.Custom View Slots
| Slot | Signature | Replaces |
|---|---|---|
headerView | UIView | Header above message list |
footerView | UIView | Footer below message list |
emptyView | UIView | Empty state display |
errorView | UIView | Error state display |
loadingView | UIView | Loading state display |
newMessageIndicatorView | UIView | New message indicator |
set(headerView:)
Replaces the default header with a custom view.| Signature | (UIView) -> Self |
| Replaces | Default header above message list |
set(footerView:)
Replaces the default footer with a custom view.| Signature | (UIView) -> Self |
| Replaces | Default footer below message list |
set(emptyView:)
Replaces the default empty state view with a custom view.| Signature | (UIView) -> Self |
| Replaces | Default empty state when no messages exist |
set(errorView:)
Replaces the default error state view with a custom view.| Signature | (UIView) -> Self |
| Replaces | Default error state when loading fails |
set(loadingView:)
Replaces the default loading indicator with a custom view.| Signature | (UIView) -> Self |
| Replaces | Default loading indicator |
set(newMessageIndicatorView:)
Replaces the default new message indicator with a custom view.| Signature | (UIView) -> Self |
| Replaces | Default new message indicator |
Text Formatters
Customize how text is displayed in messages using text formatters.set(textFormatters:)
Sets custom text formatters for message text display.| Parameter | Type | Description |
|---|---|---|
textFormatters | [CometChatTextFormatter] | Array of text formatters to apply |
setMentionAllLabel(::)
Customizes the label displayed for @all mentions.| Parameter | Type | Description |
|---|---|---|
title | String | The title for the @all mention |
subtitle | String | The subtitle for the @all mention |
AI Features
Configure AI-powered features for the message list.enableSmartReplies
Enables AI-powered smart reply suggestions.| Type | Bool |
| Default | false |
enableConversationStarters
Enables AI-powered conversation starter suggestions.| Type | Bool |
| Default | false |
enableConversationSummary
Enables AI-powered conversation summary feature.| Type | Bool |
| Default | false |
set(smartRepliesKeywords:)
Sets keywords that trigger smart reply suggestions.| Parameter | Type | Description |
|---|---|---|
smartRepliesKeywords | [String] | Keywords that trigger smart replies |
set(smartRepliesDelayDuration:)
Sets the delay duration before showing smart reply suggestions.| Parameter | Type | Description |
|---|---|---|
smartRepliesDelayDuration | TimeInterval | Delay in seconds before showing suggestions |
Reactions Configuration
Configure how reactions are displayed and behave in the message list.reactionsConfiguration
Configuration object for the reactions feature.| Type | ReactionsConfiguration |
| Default | ReactionsConfiguration() |
reactionListConfiguration
Configuration object for the reaction list display.| Type | ReactionListConfiguration |
| Default | ReactionListConfiguration() |
quickReactionsConfiguration
Configuration object for quick reactions.| Type | QuickReactionsConfiguration |
| Default | QuickReactionsConfiguration() |
messageInformationConfiguration
Configuration object for message information display.| Type | MessageInformationConfiguration |
| Default | MessageInformationConfiguration() |
Styling
Style Hierarchy
- Global styles (
CometChatMessageList.style) apply to all instances - Instance styles override global for specific instances
Global Level Styling
Instance Level Styling

Key Style Properties
| Property | Type | Default | Description |
|---|---|---|---|
backgroundColor | UIColor | CometChatTheme.backgroundColor01 | Background color of the list |
borderWidth | CGFloat | 0 | Border width for the component |
borderColor | UIColor | .clear | Border color for the component |
cornerRadius | CometChatCornerStyle? | nil | Corner radius for the component |
shimmerGradientColor1 | UIColor | CometChatTheme.backgroundColor04 | First shimmer gradient color |
shimmerGradientColor2 | UIColor | CometChatTheme.backgroundColor03 | Second shimmer gradient color |
emptyStateTitleColor | UIColor | CometChatTheme.textColorPrimary | Empty state title color |
emptyStateTitleFont | UIFont | CometChatTypography.Heading3.bold | Empty state title font |
emptyStateSubtitleColor | UIColor | CometChatTheme.textColorSecondary | Empty state subtitle color |
emptyStateSubtitleFont | UIFont | CometChatTypography.Body.regular | Empty state subtitle font |
errorStateTitleColor | UIColor | CometChatTheme.textColorPrimary | Error state title color |
errorStateTitleFont | UIFont | CometChatTypography.Heading3.bold | Error state title font |
newMessageIndicatorTextColor | UIColor? | nil | New message indicator text color |
newMessageIndicatorBackgroundColor | UIColor? | nil | New message indicator background |
Style Properties
emojiKeyboardStyle
Customizes the appearance of the emoji keyboard.| Type | EmojiKeyboardStyle |
| Default | EmojiKeyboardStyle() |
dateSeparatorStyle
Customizes the appearance of date separators between messages.| Type | DateSeparatorStyle |
| Default | DateSeparatorStyle() |
newMessageIndicatorStyle
Customizes the appearance of the new message indicator.| Type | NewMessageIndicatorStyle |
| Default | NewMessageIndicatorStyle() |
messageBubbleStyle
Customizes the appearance of message bubbles.| Type | MessageBubbleStyle |
| Default | MessageBubbleStyle() |
actionBubbleStyle
Customizes the appearance of action message bubbles (e.g., group actions).| Type | ActionBubbleStyle |
| Default | ActionBubbleStyle() |
callActionBubbleStyle
Customizes the appearance of call action message bubbles.| Type | CallActionBubbleStyle |
| Default | CallActionBubbleStyle() |
Customization Matrix
| What to change | Where | Property/API | Example |
|---|---|---|---|
| Background color | Style | backgroundColor | UIColor.systemBackground |
| Empty state text | Style | emptyStateTitleColor, emptyStateTitleFont | Custom colors and fonts |
| Error state text | Style | errorStateTitleColor, errorStateTitleFont | Custom colors and fonts |
| Loading shimmer | Style | shimmerGradientColor1, shimmerGradientColor2 | Custom gradient colors |
| Outgoing bubble | Style | messageBubbleStyle.outgoing | UIColor.systemBlue |
| Incoming bubble | Style | messageBubbleStyle.incoming | UIColor.systemGray5 |
| Hide avatars | Property | hideAvatar | messageList.hideAvatar = true |
| Hide receipts | Property | hideReceipts | messageList.hideReceipts = true |
| Custom header | View Slot | set(headerView:) | See Custom View Slots section |
Props
All props are optional. Sorted alphabetically.actionBubbleStyle
Customizes the appearance of action message bubbles.| Type | ActionBubbleStyle |
| Default | ActionBubbleStyle() |
callActionBubbleStyle
Customizes the appearance of call action message bubbles.| Type | CallActionBubbleStyle |
| Default | CallActionBubbleStyle() |
dateSeparatorStyle
Customizes the appearance of date separators.| Type | DateSeparatorStyle |
| Default | DateSeparatorStyle() |
disableSoundForMessages
Disables notification sounds for new messages.| Type | Bool |
| Default | false |
disableSwipeToReply
Disables the swipe-to-reply gesture on messages.| Type | Bool |
| Default | false |
emojiKeyboardStyle
Customizes the appearance of the emoji keyboard.| Type | EmojiKeyboardStyle |
| Default | EmojiKeyboardStyle() |
emptySubtitleText
Custom subtitle text for the empty state view.| Type | String |
| Default | "" |
emptyTitleText
Custom title text for the empty state view.| Type | String |
| Default | "No Messages" |
enableConversationStarters
Enables AI-powered conversation starter suggestions.| Type | Bool |
| Default | false |
enableConversationSummary
Enables AI-powered conversation summary feature.| Type | Bool |
| Default | false |
enableSmartReplies
Enables AI-powered smart reply suggestions.| Type | Bool |
| Default | false |
errorSubtitleText
Custom subtitle text for the error state view.| Type | String |
| Default | "" |
errorTitleText
Custom title text for the error state view.| Type | String |
| Default | "Something went wrong" |
hideAvatar
Hides the sender’s avatar in message bubbles.| Type | Bool |
| Default | false |
hideBubbleHeader
Hides the header section of message bubbles (sender name, timestamp).| Type | Bool |
| Default | false |
hideCopyMessageOption
Hides the copy message option in message actions.| Type | Bool |
| Default | false |
hideDateSeparator
Hides the date separator between messages.| Type | Bool |
| Default | false |
hideDeleteMessageOption
Hides the delete message option in message actions.| Type | Bool |
| Default | false |
hideEditMessageOption
Hides the edit message option in message actions.| Type | Bool |
| Default | false |
hideEmptyView
Hides the empty state view when no messages are available.| Type | Bool |
| Default | false |
hideErrorView
Hides the error view when an error occurs.| Type | Bool |
| Default | false |
hideFlagMessageOption
Hides the flag/report message option in message actions.| Type | Bool |
| Default | false |
hideFooterView
Hides the footer view of the message list.| Type | Bool |
| Default | false |
hideGroupActionMessages
Hides group action messages (join/leave notifications).| Type | Bool |
| Default | false |
hideHeaderView
Hides the header view of the message list.| Type | Bool |
| Default | false |
hideLoadingView
Hides the loading view when fetching messages.| Type | Bool |
| Default | false |
hideMessageInfoOption
Hides the message info option in message actions.| Type | Bool |
| Default | false |
hideMessagePrivatelyOption
Hides the option to message privately.| Type | Bool |
| Default | false |
hideNewMessageIndicator
Hides the new message indicator.| Type | Bool |
| Default | false |
hideReactionOption
Hides the reaction option on messages.| Type | Bool |
| Default | false |
hideReceipts
Hides message read receipts (ticks).| Type | Bool |
| Default | false |
hideReplyInThreadOption
Hides the reply in thread option.| Type | Bool |
| Default | false |
hideReplyMessageOption
Hides the reply to message option in message actions.| Type | Bool |
| Default | false |
hideShareMessageOption
Hides the share message option in message actions.| Type | Bool |
| Default | false |
hideTranslateMessageOption
Hides the message translation option.| Type | Bool |
| Default | false |
messageAlignment
Sets the alignment of messages in the list.| Type | MessageAlignment |
| Default | .standard |
messageBubbleStyle
Customizes the appearance of message bubbles.| Type | MessageBubbleStyle |
| Default | MessageBubbleStyle() |
messageInformationConfiguration
Configuration object for message information display.| Type | MessageInformationConfiguration |
| Default | MessageInformationConfiguration() |
messagesRequestBuilder
Custom request builder for filtering messages.| Type | MessagesRequest.MessageRequestBuilder? |
| Default | nil |
newMessageIndicatorStyle
Customizes the appearance of the new message indicator.| Type | NewMessageIndicatorStyle |
| Default | NewMessageIndicatorStyle() |
quickReactionsConfiguration
Configuration object for quick reactions.| Type | QuickReactionsConfiguration |
| Default | QuickReactionsConfiguration() |
reactionsConfiguration
Configuration object for the reactions feature.| Type | ReactionsConfiguration |
| Default | ReactionsConfiguration() |
reactionListConfiguration
Configuration object for the reaction list display.| Type | ReactionListConfiguration |
| Default | ReactionListConfiguration() |
reactionsRequestBuilder
Custom request builder for fetching reactions.| Type | ReactionsRequest.ReactionsRequestBuilder? |
| Default | nil |
scrollToBottomOnNewMessages
Automatically scrolls to bottom when new messages arrive.| Type | Bool |
| Default | true |
showMarkAsUnreadOption
Shows the “Mark as unread” option in message actions.| Type | Bool |
| Default | false |
startFromUnreadMessages
Starts the message list from the first unread message.| Type | Bool |
| Default | false |
textFormatters
Array of text formatters for customizing message text display.| Type | [CometChatTextFormatter] |
| Default | [] |
Events
The MessageList component provides callback events for handling state changes.set(onLoad:)
Fires when messages are successfully loaded.| Parameter | Type | Description |
|---|---|---|
onLoad | ([BaseMessage]) -> Void | Callback with loaded messages |
set(onEmpty:)
Fires when the message list is empty.| Parameter | Type | Description |
|---|---|---|
onEmpty | () -> Void | Callback when list is empty |
Date Time Formatter
Customize how timestamps appear in the message list using theCometChatDateTimeFormatter.
Global Level Formatting
Instance Level Formatting
set(datePattern:)
Sets a custom date pattern for message timestamps.| Parameter | Type | Description |
|---|---|---|
datePattern | (Int?) -> String | Closure that formats timestamp to date string |
set(timePattern:)
Sets a custom time pattern for message timestamps.| Parameter | Type | Description |
|---|---|---|
timePattern | (Int) -> String | Closure that formats timestamp to time string |
set(dateSeparatorPattern:)
Sets a custom pattern for date separators between messages.| Parameter | Type | Description |
|---|---|---|
dateSeparatorPattern | (Int?) -> String | Closure that formats timestamp to date separator string |
Available Formatters
| Formatter | Purpose | Default Format |
|---|---|---|
time | Standard time display | h:mm a |
today | Messages sent today | Today |
yesterday | Messages from yesterday | Yesterday |
lastweek | Messages within last week | Day name |
otherDay | Older messages | MMM d, yyyy |
datePattern | Custom date pattern | Configurable |
timePattern | Custom time pattern | Configurable |
dateSeparatorPattern | Date separator between messages | Configurable |
Common Patterns
Hide message options
Disable sounds
Custom empty state
Scroll to bottom on new messages
Hide UI elements
Related Components
- Messages - Parent component containing MessageList
- Message Composer - Send messages in a conversation
- Message Header - Display user/group details
- Message Template - Create custom message bubble templates
- Threaded Messages - Display threaded conversations