CometChatThreadHeader is the strip at the top of a thread: the message the thread
started from, drawn as a bubble; a bar with the reply count; and a bell that follows or
unfollows the thread. It keeps itself up to date — new replies, edits, deletions, receipts
and pins on the parent all show while it is on screen.

Where It Fits
The Kit has no thread screen — you compose one from the thread header, the message list in thread mode and the message composer replying in the thread:- SwiftUI
- UIKit
The message list raises
onThreadRepliesClick when someone taps “N replies” or chooses
Reply in thread; open your thread screen from there.Quick Start
The list fills the screen, and the thread header and the composer are bars over it, hosted as Conversation List + Message View hosts the chat’s. Stacked in a stack view instead, nothing passes under the bars.- SwiftUI
- UIKit
The bars use
safeAreaBar on iOS 26, so the rows fade softly behind each bar, and
safeAreaInset before it.What It Shows
- SwiftUI
- UIKit
The parent is drawn with the list’s bubble for the message. A new parent object — a refetched
copy, say — re-reads its reply count and its subscription. The strip is at most
maxHeight
tall — 250 pt. A taller parent scrolls inside it and the bar stays at the bottom. Pass nil
for no cap.The reply count
The count starts from the parent’sreplyCount and goes up for every reply to the thread:
anyone’s, of every message kind, including yours — whether sent here or from another of
your devices. Each reply counts once. A deleted reply stays counted, as the server’s
count does. Replies from an AI assistant do not count.
- SwiftUI
- UIKit
hideReplyCount hides the count’s text; replyCountView replaces it.Actions and Events
Callback Methods
- SwiftUI
- UIKit
SDK Events (Real-Time, Automatic)
No wiring required. New replies, edits, deletions, receipts and pins on the parent all show while the header is on screen.Following the Thread
The bell follows or unfollows the thread throughCometChatThreadSubscription. It shows
when thread subscriptions are on and the parent has been sent. A tap shows a toast, and the
callback hears the new state once the server accepts it:
- SwiftUI
- UIKit
isSubscribed sets the bell’s state instead of the parent’s flag, until the thread’s next
change. The bell follows changes made anywhere — the message list’s menu, another screen —
because they all go through CometChatThreadSubscription.Functionality
- SwiftUI
- UIKit
Hiding Parts
- SwiftUI
- UIKit
To hide the bell and put your own in your screen’s bar:
Custom View Slots
- SwiftUI
- UIKit
Replace the parent’s bubble, the count’s text or the bell. The count view is handed the
count and gets no padding of its own:The bell’s replacement shows only where the bell would — never on an unsent parent or
with thread subscriptions off. The same three slots are modifiers, for a whole subtree;
an initialiser argument wins:
bubbleFactories draw the parent with your bubble for its kind, as in the message list.Common Patterns
A bell in your bar instead
- SwiftUI
- UIKit
To put the bell in your screen’s bar, hide this one and build yours over
CometChatThreadSubscription — it owns the debounce, the optimistic update and the revert:Advanced Methods
Store Access
- SwiftUI
- UIKit
CometChatThreadHeaderStore holds the parent, the count and the subscription. Pass your
own to read them, or a seeded one for a preview — a seeded store never listens:getCurrentParentMessage(), toggleThreadSubscription(), the observable
state and onSubscriptionToggle.Subclassing
- SwiftUI
- UIKit
CometChatThreadHeader is a View struct. Customise it with its slots, modifiers and style.Objective-C
- SwiftUI
- UIKit
Not applicable —
CometChatThreadHeader is a SwiftUI View.Accessibility
- The count reads as “3 Replies” and is a header.
- The bell is a button labelled with its action: “Subscribe to thread” or “Unsubscribe from thread”.
- SwiftUI
- UIKit
The bell’s tap area is 44 × 44. The parent reads as the message list’s row does.
Style
- SwiftUI
- UIKit
CometChatThreadHeaderStyle is sparse: set only what you change.incomingMessageBubbleStyle and outgoingMessageBubbleStyle are accepted and change
nothing. Style the parent with bubbleFactories, or with the message list’s style.Next Steps
Message List
Show the thread’s replies
Message Composer
Reply in the thread
Conversation List + Message View
Host the chat’s message screen
Threaded Messages
Build a thread screen end to end