Skip to main content
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.
Pin Message must be enabled for your app in the CometChat Dashboard. Until it is, the message list offers no Pin option and this screen has nothing to show. Read the switch with CometChatSession.isPinMessageEnabled() to gate your own entry point.
CometChatPinnedMessages showing the pinned messages of a conversation

Where It Fits

A pin is conversation-wide, so the screen takes the chat’s User 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.

Quick Start

Open it from the header’s Pinned Messages entry, and jump the list to the message a row hands you:
Host the header and the composer over the list as Conversation List + Message View shows.Push it inside a 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

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

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

Pass a user or a group.

States


Custom View Slots


Advanced Methods

Store Access

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

CometChatPinnedMessages is a View struct. Customise it with its slots, style and bubble factories.

Style

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