Overview
Pin and save look alike in the action sheet but behave differently:
With the iOS UI Kit you get: the action-sheet options, pin and bookmark indicators on the bubble, and two full-screen list surfaces.
Prerequisites
- Completed Getting Started setup
- CometChat UIKit v5+ installed
- User logged in with
CometChatUIKit.login() - Pin and save enabled for your app
Components
Integration Steps
Step 1: Turn the Features On
Both features are off by default. Nothing appears in the action sheet until you opt in.Step 2: Find the Options
Long-press a message to open the action sheet. Pin and save sit behind a “More…” row, which keeps the sheet from overflowing on smaller screens. Tapping it swaps the list, and tapping it again goes back. To change which options live behind that row, editMessageOptionConstants.overflowOptionIds:
Step 3: Add the Pinned Messages Screen
Pinned messages belong to one conversation, so open this from that conversation — typically the message header’s overflow menu.Step 4: Add the Saved Messages Screen
Saved messages span every conversation, so this one belongs in your app’s chrome — a tab, the chats-screen menu, or a profile entry. It takes no user or group.onMessageClicked has to resolve the conversation — see Saved Messages for that snippet.
Step 5: Handle Errors
Failures roll the change back automatically and show a message. To react yourself, listen for the error codes onPinSaveErrorCodes:
Always read the cap from
errorParams["limit"]. The limit is server-owned and hard-coding it means your copy goes stale the moment it changes.Customization Options
Who Can Pin
Pinning is gated by role, not authorship — a moderator can pin someone else’s message, and a participant cannot pin their own. The kit usesGroupMembersUtils.allowPinMessage(group:):
Saving has no role gate — anyone can save anything they can see.
Use the same check to hide the unpin action for users who cannot pin:
Hiding Individual Options
enable* turns the feature on; hide* suppresses one option independently.
Styling
Both screens take their own style object built from theme tokens:Reacting to Pin and Save Elsewhere
Conform toCometChatMessageEventListener to update your own UI when the local user pins or saves:
Edge Cases
Error Handling
Feature Matrix
Related Components
- Pinned Messages - Per-conversation pinned list
- Saved Messages - User-level saved list
- Message List - Hosts the options and indicators
- Events - Pin and save event callbacks
Chat SDK: Pin & Save
The underlying SDK methods and message fields
Core Features
Overview of messaging features