Skip to main content
Events allow different parts of your app to communicate without direct dependencies. When a user performs an action (like blocking someone, deleting a conversation, or sending a message), events are emitted so other components can react accordingly.

How Events Work

  1. Subscribe to events using addListener in viewDidLoad
  2. React to events in your listener callback methods
  3. Unsubscribe using removeListener in viewWillDisappear

User Events

Listen for user-related actions like blocking and unblocking.

Emit User Events

Notify other components when you block/unblock a user:

User Events Reference

Group Events

Listen for group-related actions like creating groups, adding members, and role changes.

Emit Group Events

Notify other components about group actions:

Group Events Reference

Conversation Events

Listen for conversation-level actions like delete and update.

Emit Conversation Events

Conversation Events Reference

Message Events

Listen for message-related actions like send, edit, delete, and reactions.

Emit Message Events

Message Events Reference

Card Events

Listen for taps on interactive elements (buttons, links) inside card bubbles. The UI Kit renders card bubbles automatically (CometChatCardBubble) and emits ccCardActionClicked when a user taps an action inside one — so a single listener handles every card action across your app. The source message is a CardMessage for standalone card messages and an AIAssistantMessage for cards embedded in AI agent replies.
CometChatCardActionEvent (from CometChatCardsSwift) carries:

Card Events Reference

Call Events

Listen for call-related actions like initiating, accepting, and ending calls.

Emit Call Events

Call Events Reference

Complete Example: App-Wide Event Manager

Create a centralized event manager to handle events across your entire app:

Using the Event Manager

Best Practices

  1. Always remove listeners - Call removeListener in viewWillDisappear to prevent memory leaks
  2. Use unique listener IDs - Avoid conflicts between components by using descriptive, unique IDs
  3. Update UI on main thread - Dispatch UI updates to the main thread when handling events
  4. Don’t emit unnecessarily - Only emit events when state actually changes
  5. Use a central manager - For app-wide event handling, create a singleton manager

Next Steps

Methods

Reference for UI Kit wrapper methods.

Message List

Display and customize chat messages.

Conversations

Manage conversation lists.

Groups

Work with group chat functionality.