CometChatSavedMessages is a full-screen list of the messages the logged-in user has saved, newest save first. Saves are private to the user and span every conversation, so each row is labelled with the chat it came from.
AI Integration Quick Reference
AI Integration Quick Reference
Where It Fits
This is a user-level screen, not a per-conversation one. It takes no
user or group — it always shows the logged-in user’s saves across every chat. Open it from your app’s chrome (a tab, the chats-screen menu, a profile or settings entry), not from a conversation header.Minimal Render
CometChatSavedMessages is a view controller with a no-argument initializer.
Filtering
The list is fetched with aMessagesRequest.MessageRequestBuilder. The default comes from SavedMessagesBuilder:
uid or guid to set — saved messages are a per-user collection spanning every conversation. The server caps saves at 100, so a limit of 100 fetches the entire list in one page.
Actions and Events
Callback Props
onMessageClicked
Fires when a row is tapped. Because a row can belong to any conversation, use it to open that message’s own chat — see Common Patterns.onError
Fires when the fetch fails, and again when an unsave fails.onLoad
Fires with the fetched messages each time the list reloads.onEmpty
Fires when the fetch completes with nothing saved.onBack
Inherited fromCometChatListBase. The component ships a default that pops the navigation stack; set your own to replace it — useful when you also need to re-hide the navigation bar on the way out.
Actions Reference
Global UI Events
See Events for the full listener surface.
Custom View Slots
Each slot receives the row’sBaseMessage and returns a view that replaces the default.
set(titleView:)
Replaces the row title, which by default is the source conversation name rather than the sender.set(subtitle:)
Replaces the message-preview line.set(leadingView:)
Replaces the leading slot, which holds the source conversation’s avatar by default.set(trailingView:)
Replaces the trailing slot, which holds the timestamp by default.set(listItemView:)
Replaces the entire row.Styling
Style Hierarchy
SavedMessagesStyle conforms to ListBaseStyle and ListItemStyle, so it carries the standard list properties plus two save-specific ones.
Global Level Styling
Instance Level Styling
Key Style Properties
Customization Matrix
Props
All props are optional. Sorted alphabetically.avatarStyle
Styling for the row avatar, which shows the source conversation.dateStyle
Styling for the row timestamp.dateTimeFormatter
Custom timestamp formatting.hideUnsaveOption
Hides the per-row unsave swipe action.style
The component’s style object.Methods
set(requestBuilder:)
Replaces the request used to fetch the list. Must retainset(saved: true).
set(textFormatters:)
Applies custom text formatters to the message previews.SavedMessagesViewModel is public in name only — every member except setRequestBuilder(requestBuilder:) is internal. Customize through the props and view slots above rather than the view model.Common Patterns
Open from the chats screen menu
Saves are user-level, so the entry point belongs in app chrome rather than a conversation.Open the conversation a row came from
A saved row can belong to any chat, so resolve the conversation from the message before navigating. For a group, look it up byreceiverUid. For one-to-one, a received message is addressed to the logged-in user, so the conversation is with its sender.
Custom empty state
Related Components
- Pinned Messages - The per-conversation pinned messages screen
- Message List - Where messages are saved and unsaved
- Conversations - The chats screen that hosts the entry point
- Events - Pin and save event callbacks
Pin and Save Messages Guide
End-to-end setup for pinning and saving
Chat SDK: Pin and Save
The underlying SDK methods and message fields