Skip to main content
The UI Kit offers two levels of event handling: callbacks on one component, and the Kit’s event bus, which carries what this user did anywhere in the Kit.

Component-Level Callbacks

Click Callbacks

Callbacks hand you SDK objects — here a CometChatSDK.Conversation.
A long press belongs to the context menu on iOS: onItemLongClick fires only when no context menu is configured. React to a menu choice with onOptionSelected instead.

Selection Mode

selection is a Binding, so your view owns it. onSelection fires once, when the user submits from the selection toolbar:
While selection is on, a tap only toggles the row: onItemClick and onItemLongClick do not fire.

Global Events

The SDK tells you what other people did. It does not echo this user’s own actions back, so the Kit has an event bus: the component that performs an action announces it — a message sent, a user blocked, a member kicked — and every other component showing the same data updates.

Subscribing to Events

Every event has a view modifier that listens while the view is on screen:
Or one modifier per family:
Outside a view, iterate the family’s stream:
Handlers run on the main thread, in the order the events were emitted. A listener in one toolkit hears events from the other and from your own code: both toolkits read one bus.

Emitting Events

Emit when a screen you built does something the Kit cannot see — blocking from your own profile screen, creating a group from your own form — or the Kit’s lists go stale.
Send messages through the Kit — CometChatSession.sendTextMessage(_:) in SwiftUI, CometChatUIKit.sendTextMessage(message:) in UIKit — and the Kit announces them for you.

Key Event Types

Message events Call events Conversation events The SwiftUI name is the case of the family’s event enum (CometChatMessageEvent …); the UIKit name is the listener method and the static emitter.

Component vs Global Events