Skip to main content

Architecture

The UI Kit is a set of independent components that compose into chat layouts. A typical chat layout uses four core components:
  • CometChatConversations — list of recent conversations
  • CometChatMessageHeader — bar with avatar, name, status, typing indicator
  • CometChatMessageList — scrollable message feed with reactions, receipts, threads
  • CometChatMessageComposer — rich input with attachments, mentions, voice notes
Selecting a conversation yields an SDK Conversation whose conversationWith is a User or a Group. Pass it to the message components to load the chat. Each component’s state lives in a store in CometChatCore — ConversationsStore, MessageListStore and so on — which both toolkits render, so the two can never disagree about what to show. Components talk to each other through the Kit’s event bus. See Events.
In CometChatSwiftUI, components are SwiftUI Views, configured through initialiser parameters and modifiers that cascade to everything below them. Callbacks speak SDK types.

Component Catalog

Every component exists in both toolkits unless the table says otherwise.

Conversations and Lists

Messages

Calling

There is no CometChatIncomingCall component. An incoming call rings through CallKit, with the CometChat Push Notifications SDK, and the call screen appears once it is answered. See Calling Integration.

Component API Pattern

All components share a consistent API surface in each toolkit. The examples use the conversation list and the message components; every component follows the same shape.

Setting User or Group

Callbacks

Data Filtering

Pass the SDK’s request builder to choose what a list fetches. The closure runs for every fetch, so return a new builder each time.

View Slots

Replace one region of a component’s UI with your own view. See View Slots.
A slot is an initialiser parameter, or a modifier that applies to every component below it:

Styles

Every component takes a style; anything you leave unset falls through to the theme. See Component Styling.
Style values are structs, passed as style:

Events

Components publish what happens — a message sent, a user blocked, a group member added — so the rest of your app can react. See Events for the full reference.
Listen with a modifier, which stops listening when the view goes away:

Next Steps

Core Features

Chat features included out of the box

Theming

Customize colors, fonts, and styles

Customization

Deep customization through stores, styles, and view slots

Guides

Task-oriented tutorials for common patterns