CometChatPinnedMessages lists the messages pinned in one conversation, newest pin first.
Each row is the message’s own bubble under “name • date”. Tap a row to jump to the message;
long-press it for Message Information, Copy, Translate, Unpin and Delete; swipe it to unpin.

Where It Fits
A pin is conversation-wide, so the screen takes the chat’sUser or Group and shows the
same set to everyone in it. Messages are pinned and unpinned from the
message list’s menu; this screen is the read view.
- SwiftUI
- UIKit
Quick Start
Open it from the header’s Pinned Messages entry, and jump the list to the message a row hands you:- SwiftUI
- UIKit
NavigationStack: it uses the system navigation bar with an inline title.
The back chevron calls onBack and nothing else. With hideBackIcon: true the system’s
own back button shows instead — the choice for a pushed screen.Rows
- SwiftUI
- UIKit
Each row is the message’s bubble — the same bubble the message list draws, with your
bubbleFactories — on the leading side with the sender’s avatar, under “name • date”.
Your own messages read “You” and keep the outgoing colours. Rows show no receipt and no
“N replies”, and the bubble’s content does not take taps: a tap anywhere on the row is
onMessageClick.The date is dateTimeFormatter’s otherDays answer when you pass one; its time answer
replaces the bubble’s time.Actions and Events
Callback Methods
- SwiftUI
- UIKit
Gestures
Unpin and Delete ask first. Confirming removes the row at once; if the server refuses, the
row comes back where it was, a toast says why, and
onError is called. Info opens
Message Information in a sheet. There is no
Pin option on this screen.
SDK Events (Real-Time, Automatic)
The screen keeps itself current from its own SDK listener and the Kit’s event bus: a pin or unpin made anywhere in the app adds or removes the row; an edit redraws it; a message deleted elsewhere leaves the list. After a reconnect the list is fetched again. It loads every page up front — 30 at a time, until there are at least 100 rows — in the server’s order, newest pin first. A failure on any page shows the error state.Functionality
- SwiftUI
- UIKit
Pass a user or a group.
States
Custom View Slots
- SwiftUI
- UIKit
Advanced Methods
Store Access
- SwiftUI
- UIKit
PinnedMessagesStore fetches, unpins, deletes, copies and translates, and holds uiState,
messages and count. Pass your own to read them, or a seeded one for a preview — a seeded
store never fetches:Subclassing
- SwiftUI
- UIKit
CometChatPinnedMessages is a View struct. Customise it with its slots, style and bubble factories.Style
- SwiftUI
- UIKit
CometChatPinnedMessagesStyle is sparse: set only what you change. The bubbles take
messageListStyle — the message list’s own style — so a pinned bubble matches the chat.Next Steps
Message List
Pin and unpin messages, and jump to one
Message Header
Open the screen from the header’s entry
Message Information
Delivery and read details for a message
Saved Messages
The messages a user saved for themselves