Skip to main content
CometChatConversations displays a list of all conversations (one-on-one and group chats) for the currently logged-in user. It shows the last message, unread count, typing indicators and user presence, and updates in real time.
CometChatConversations showing recent chats with avatars, last-message previews, receipts, timestamps and unread badges

Where It Fits

CometChatConversations is the entry screen of a chat experience: the list a user lands on, from which they open a conversation.
Both toolkits read from the same store, so the SwiftUI and UIKit lists can never disagree about what to show.

Quick Start

That is a working list: it fetches the first page, paginates as you scroll, and updates live as messages arrive. onItemClick hands you a CometChatSDK.Conversation.The list draws a system large-title navigation bar, so it brings its own NavigationStack. If your screen already has one, pass embedsNavigationStack: false.Set-up: Getting Started.

Filtering Conversations

The builder closure is called fresh for every fetch, so return a new builder each time rather than capturing one instance. Reusing one instance across pages produces undefined paging behaviour.

Filter Recipes


Actions and Events

Callback Methods

onItemLongClick fires only when no context menu is configured. iOS gives the long-press gesture to the context menu, so the two are mutually exclusive. In selection mode it does not fire.

Global Events

The list listens on the Kit event bus, whoever emits the events.
A .conversationDeleted event removes the row and a .conversationUpdated event merges it. Subscribe from any view:
See Events for the whole bus.

SDK Events (Real-Time, Automatic)

No wiring required — the store listens and the list updates itself.
The screen draws a system large-title navigation bar — “Chats”, with the search field in the bar under the large title. That gives you Liquid Glass on iOS 26 and an opaque bar below it. The field is the bar’s own, so it stays on screen while the list scrolls, and rows passing under it fade into the bar. The screen supplies its own NavigationStack so it works on its own; pass embedsNavigationStack: false if you already have one.
The search field is a button. Touching it calls onSearchClick and nothing else — the list does not filter itself. The field opens a search screen: wire onSearchClick to yours.

Pinning Conversations

Pin and unpin appear in the swipe actions and in the long-press menu. Pinning happens at once; unpinning asks first. A pinned row stays above the rest and keeps its place when new messages arrive elsewhere. The affordance is hidden when the app does not have the pin feature enabled server-side, or when an administrator pinned the row — the server refuses to let a user unpin that one, so offering it would only produce an error. Delete is hidden on that row as well, for the same reason: the row is the administrator’s, and it comes back pinned whatever the user deletes.
hidePinOption hides the Pin / Unpin affordance, and hideDeleteOption hides Delete from the swipe actions and the long-press menu.

Functionality

dateFormat formats the timestamp on each row and takes precedence over dateTimeFormatter. hideSeparator is true by default: pass false to draw the separator and separatorColor / separatorHeight to style it.cometChatConversationsHidden(_:) takes an option set and unions with the hide* arguments — neither cancels the other.

Custom View Slots

Every slot is available two ways: as an initialiser argument, and as a modifier that cascades to every CometChatConversations below it in the hierarchy.
Supply both and the initialiser argument wins. Full order: initialiser argument, then modifier, then theme, then the Kit default. This is the usual answer to “why didn’t my change apply?”.
For comparison, the list with no overrides at all:
Default Conversations list with the built-in row: avatar, name, last message, timestamp and unread badge
itemView replaces the entire row. It receives the conversation and whether it is selected.
Conversations list where itemView replaces the entire row with a custom card layout
leadingView replaces the avatar.
Conversations list with a custom leading view replacing the default avatar
titleView replaces the name line.
Conversations list with a custom title view replacing the default name line
subtitleView replaces the last-message line.
Conversations list with a custom subtitle view replacing the last-message line
trailingView replaces the date, badge and receipt column.
Conversations list with a custom trailing view replacing the date and unread badge column
State views. errorView receives a retry closure — call it to re-attempt the fetch.
Conversations list showing a custom loading view

loadingView

Conversations list showing a custom empty state

emptyView

Conversations list showing a custom error state with a retry button

errorView

overflowMenu adds your own toolbar menu.

Give the list options and each row shows them twice: as trailing swipe actions and as a long-press menu. options replaces the built-in options; addOptions appends to them. Reach for addOptions unless you want the defaults gone. The two built-ins are Delete and Pin / Unpin.
Conversations context menu showing only custom actions, replacing the built-in ones

options — defaults replaced

Conversations context menu showing custom actions appended below the built-in ones

addOptions — appended to defaults

A context menu claims the long-press gesture, so onItemLongClick fires only when no menu is configured. Use onOptionSelected to react to a menu choice.

Common Patterns

Open a chat on tap

Multi-select with a custom toolbar

Groups only, with your own empty state

Preview without credentials


Date Time Formatter

Row timestamps use a relative format by default — “now”, “12:04”, “Yesterday”, “9 Oct 25”.
There are two ways to change it. dateFormat replaces it wholesale and wins over everything else:
dateTimeFormatter changes one bucket at a time — today’s time, “Yesterday”, the weekday inside a week, a date beyond it. Implement only the methods you care about; the rest fall back to the default:

Mention Configuration

A row’s last-message line runs the text-formatter chain, as the message list does. The default is one CometChatMentionsFormatter, so <@uid:…> reads as @Name (from the message’s mentionedUsers) and <@all:…> as @all. A mention of someone else draws in the theme’s primary colour, a mention of you or of everyone in its warning colour.
style.mentionTextColor and style.mentionBackgroundColor restyle the first.
textFormatters replaces the chain: pass your own formatters to change what the line says, or [] to show the raw text. mentionAllLabelId / mentionAllLabel configure the default formatter only.

Advanced Methods

Selection

While selection is on, tapping a row only toggles it: onItemClick does not fire, so a tap handler cannot push a screen out from under someone who is picking rows.
searchText and selection are Bindings, so your view owns them:
Selection reports in two places, and the difference matters:

Store Access

The store is the data source. It is injectable and non-final. Seed it to render fixed state with no session:
A seeded store performs no fetching, searching or pagination.The view has no imperative methods; ask the list to return to the top through the store, not the view — a SwiftUI view is a value and has nothing to call a method on.
The store already scrolls to top by itself when a new message arrives; this is the same mechanism exposed for your own use.

Subclassing

CometChatConversations is a View struct, so behaviour that a UIKit app would achieve by subclassing is supplied as values instead. ConversationsPolicy carries the behaviour hooks — which custom messages update their conversation, and threaded-message detection.

Style

Style properties are optional and resolved at render, so anything left unset falls through to the theme instead of being frozen at construction.Global level:
Instance level:

Next Steps

Users

List the users a person can start a chat with

Message List

Show the messages of the conversation a tap opens

Theming

Colour, typography and shape tokens

Overview

Choose a toolkit and see what the Kit includes