> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> The layers of the CometChat iOS UI Kit v6 — stores and policies, two toolkits — and every customization entry point.

Every component in the UI Kit is built in layers. Knowing them is the key to deep
customization without rebuilding a component from scratch.

***

## Architecture Layers

| Layer | Product | Role | Example |
| - | - | - | - |
| Toolkit | `CometChatSwiftUI` or `CometChatUIKit` | the component you place on screen: callbacks, slots, styles, navigation | `CometChatConversations`, `CometChatMessageList` |
| Store and policy | `CometChatCore` | state, paging, SDK listeners, the Kit's event bus, behaviour hooks | `ConversationsStore`, `MessageListStore`, `ConversationsPolicy` |
| Chat SDK | `CometChatSDK` | the calls to CometChat's servers | `ConversationRequest`, `CometChat.sendTextMessage` |

```mermaid theme={null}
block-beta
    columns 1
    A["Toolkit\nCometChatSwiftUI · CometChatUIKit\ncallbacks, slots, styles"]
    B["Store and policy — CometChatCore\nstate, paging, listeners, events"]
    C["Chat SDK\nrequests and real-time listeners"]

    A --> B
    B --> C
```

The store lives in `CometChatCore` and is shared by both toolkits, so the SwiftUI and UIKit
screens can never disagree about *what* to show. An app links one toolkit.

***

## Providing the Store

Every list component accepts a store you create. Use it to configure fetching before the
screen appears, to call the store's methods, or to inject a seeded store for previews and tests.

> [tab] SwiftUI
>
> ```swift theme={null}
> struct ChatsScreen: View {
>     @State private var store = ConversationsStore(
>         pageSize: 20,
>         conversationsRequestBuilder: {
>             ConversationRequest.ConversationRequestBuilder(limit: 20).setConversationType(conversationType: .user)
>         }
>     )
>
>     var body: some View {
>         CometChatConversations(store: store)
>     }
> }
> ```

> [tab] UIKit
>
> ```swift theme={null}
> let store = ConversationsStore(
>     pageSize: 20,
>     conversationsRequestBuilder: {
>         ConversationRequest.ConversationRequestBuilder(limit: 20).setConversationType(conversationType: .user)
>     }
> )
> let conversations = CometChatConversations(conversationsStore: store)
> ```

Stores are `@Observable`, so SwiftUI views and UIKit observation both follow their state. See
[Stores & Data](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-store-data.md).

***

## Policies instead of overrides

Behaviour hooks live on a **policy**
— a value of closures the store consults — so you change one rule without subclassing:

| Policy | Used by | Decides |
| - | - | - |
| `ConversationsPolicy` | `ConversationsStore` | which custom messages update their conversation, threaded-message detection |
| `MessageListPolicy` | `MessageListStore` | which messages sound, show, count as unread, or are thread replies |
| `MessageOptionsPolicy` | the message list's menu | who may edit, delete, report, see Info, message privately |
| `ComposerPolicy` | `MessageComposerStore` | when the composer starts and ends typing indicators |
| `SearchPolicy` | `SearchStore` | debounce delay, page sizes, filter-chip behaviour |
| `ReactionListPolicy` | the reaction list's store | page size |

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatConversations(
>     policy: ConversationsPolicy(
>         shouldUpdateForCustomMessage: { message in message.type == "meeting" }
>     )
> )
> ```

> [tab] UIKit
>
> ```swift theme={null}
> conversations.conversationsStore.policy = ConversationsPolicy(
>     shouldUpdateForCustomMessage: { message in message.type == "meeting" }
> )
> ```

***

## Subclassing (UIKit)

The UIKit toolkit keeps `open` classes and override points — `defaultSetup()`,
`setupStyle()`, `reloadData()`, the cell's `configure(…)`. The
SwiftUI toolkit has no subclassing: views are values, and behaviour comes from arguments,
modifiers and policies.

> [tab] SwiftUI
>
> Wrap the component in your own view and pass it arguments:
>
> ```swift theme={null}
> struct GroupChats: View {
>     var body: some View {
>         CometChatConversations(
>             conversationsRequestBuilder: {
>                 ConversationRequest.ConversationRequestBuilder(limit: 30)
>                     .setConversationType(conversationType: .group)
>             }
>         )
>     }
> }
> ```

> [tab] UIKit
>
> ```swift theme={null}
> final class GroupChatsViewController: CometChatConversations {
>     override func setupStyle() {
>         super.setupStyle()
>         view.backgroundColor = .systemGroupedBackground
>     }
> }
> ```

***

## SDK Listeners vs UI Kit Events

Stores use two event systems:

| Aspect | SDK listeners | UI Kit events |
| - | - | - |
| Source | CometChat's servers | the Kit's components, and your code |
| Direction | server → app | component → component |
| Carries | what **other people** did: messages, typing, presence, calls | what **this user** did through the Kit: sent, blocked, joined |
| Registration | `CometChat.addMessageListener(_:_:)` and siblings | SwiftUI: `.onCometChat…` modifiers or `CometChatEvents`; UIKit: `CometChat…Events.addListener(_:_:)` |

Both are needed: the SDK does not echo this user's own actions back. See
[Events & Callbacks](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-events.md).

***

## Customization Categories

> [card] [View Slots](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-view-slots.md)
>
> Replace one region of a row — leading, title, subtitle, trailing — or the whole row.

> [card] [Styles](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-styles.md)
>
> SwiftUI style values and UIKit style objects, and how they resolve.

> [card] [Stores & Data](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-store-data.md)
>
> Request builders, store state, store methods and seeded stores.

> [card] [Events & Callbacks](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-events.md)
>
> Taps, selection, and the Kit's event bus.

> [card] [State Views](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-state-views.md)
>
> Replace or hide the loading, empty and error views.

> [card] [Text Formatters](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-text-formatters.md)
>
> Process message text — hashtags, mentions, any pattern.

> [card] [Menu & Options](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-menu-options.md)
>
> Add or replace context-menu actions and composer attachment options.

***

## What's Next

Start with [Styles](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-styles.md) for visual changes, or
[Stores & Data](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-store-data.md) for behaviour.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.