> ## 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.

# Getting Started With the UIKit UI Kit

> Step-by-step guide to add the CometChat iOS UI Kit v6 UIKit toolkit to your app: install, initialise, log in, and push your first chat screen.

> [accordion] AI Integration Quick Reference
>
> | Field | Value |
> | - | - |
> | Package | `https://github.com/cometchat/cometchat-uikit-ios.git`, from `6.0.0-beta.1` (SPM only) |
> | Product | `CometChatUIKit`; files import `CometChatUIKit` alone (it re-exports `CometChatCore`) |
> | UI layer | Native UIKit — view controllers, `UIView`s, cells, delegates and fluent `set(...)` |
> | Init | `try await CometChatSession.initialize(appID:region:)` — must finish before `login` |
> | Login | `try await CometChatSession.login(uid:authKey:)` — must finish before showing components |
> | Order | `initialize` → `login` → show. Breaking this order = an empty screen |
> | Auth Key | Development only. Production: `CometChatSession.login(authToken:)` |
> | Calling | Optional. `initialize(appID:region:enableCalling: true)` |
> | Requirements | iOS 18+, Swift 6, Xcode 26+ |

This guide adds the UIKit toolkit to an iOS app. The toolkit is a **native implementation** — real view
controllers, cells and delegates, not SwiftUI views in a hosting controller. It suits apps upgrading from v5; see
[Migrating from v5](https://www.cometchat.com/docs/ui-kit/ios/v6/migrating-from-v5.md). By the end you have a working chat screen.

***

## Prerequisites

You need your app's **App ID**, **Auth Key** and **Region** from the
[CometChat Dashboard](https://app.cometchat.com/) (**Your App → Credentials**), Xcode 26 or later, and
an iPhone or simulator running iOS 18 or later.

> [!WARNING]
>
> Auth Key is for development only. In production, generate Auth Tokens on your server with the
> [REST API](https://api-explorer.cometchat.com/) and log in with `CometChatSession.login(authToken:)`.
> Never ship an Auth Key in an app binary.

***

## Step 1 — Create an iOS Project

1. In Xcode, choose **File ▸ New ▸ Project…** and select **iOS ▸ App**.
2. Enter a product name, and choose **Storyboard** for Interface and **Swift** for Language.
3. Set the target's **Minimum Deployments** to **iOS 18.0**.

This guide builds its screens in code. To stop the storyboard from loading as well, delete
`Main.storyboard` and remove the **Storyboard Name** entry from **Info ▸ Application Scene Manifest ▸
Scene Configuration** in your target.

***

## Step 2 — Add the Package

1. Choose **File ▸ Add Package Dependencies…** and paste
   `https://github.com/cometchat/cometchat-uikit-ios.git`.
2. Set **Dependency Rule** to **Up to Next Major Version** from `6.0.0-beta.1`.
3. Add the **`CometChatUIKit`** product to your app target.

That is the only dependency you declare. `CometChatCore`, the CometChat Chat SDK, the Cards SDK and
the Calls SDK resolve with it. The Calls SDK is included even when you don't use calling; see
[Calling](https://www.cometchat.com/docs/ui-kit/ios/v6/calling-integration.md) to leave it out.
In a `Package.swift`:

```swift Package.swift theme={null}
.package(url: "https://github.com/cometchat/cometchat-uikit-ios.git", from: "6.0.0-beta.1")
// and in your target:
.product(name: "CometChatUIKit", package: "cometchat-uikit-ios")
```

Then add the camera, microphone and photo-library usage descriptions to `Info.plist` — see Step 3 of
[Getting Started](https://www.cometchat.com/docs/ui-kit/ios/v6/getting-started.md).

> [!WARNING]
>
> v6 is **SPM only**. If your v5 app integrates through CocoaPods, moving to SPM is part of the upgrade —
> see [Migrating from v5](https://www.cometchat.com/docs/ui-kit/ios/v6/migrating-from-v5.md).

***

## Step 3 — Initialise and Log In

Initialise the Kit and log in from your scene delegate, then set the window's root view controller once
both finish. `CometChatSession` lives in `CometChatCore`, which `CometChatUIKit` re-exports, so one import
is enough:

```swift SceneDelegate.swift theme={null}
import UIKit
import CometChatUIKit

final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    var window: UIWindow?

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession,
               options connectionOptions: UIScene.ConnectionOptions) {
        guard let windowScene = scene as? UIWindowScene else { return }
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = UIViewController() // a blank screen while you log in
        window.makeKeyAndVisible()
        self.window = window

        Task {
            do {
                try await CometChatSession.initialize(appID: "APP_ID", region: "REGION")
                // The SDK keeps the session across launches — log in only when there is none.
                if CometChatSession.loggedInUser == nil {
                    _ = try await CometChatSession.login(uid: "UID", authKey: "AUTH_KEY")
                }
                // Step 4 replaces this with your chat experience.
                window.rootViewController = UINavigationController(rootViewController: CometChatConversations())
            } catch {
                print("CometChat could not start:", error)
            }
        }
    }
}
```

Replace `APP_ID`, `REGION` and `AUTH_KEY` with your credentials, and `UID` with a user's ID — every new
app has test users `cometchat-uid-1` to `cometchat-uid-5`. Run the app: you see the logged-in user's
conversations, live.

![The conversation list the minimal UIKit example shows](https://mintcdn.com/cometchat-22654f5b/pWDsskjSUHgot30F/images/ui-kit/ios/v6/uikit-stock.png?fit=max\&auto=format\&n=pWDsskjSUHgot30F\&q=85\&s=e30742b920e808a1588ea95e163faab7)

> [!WARNING]
>
> `initialize` must finish before `login`, and `login` before any component appears — a component shown
> first has no session and shows nothing. `region` must match your app's region: a mismatch fails at
> login, not at `initialize`, which makes it look like an authentication problem.

***

## Step 4 — Choose a Chat Experience

Pick the layout that suits your app. Each guide builds it step by step.

### Conversation List + Message View

Sequential navigation — the conversation list is the entry point, and a tap pushes a full-screen chat.

> [card] [Build Conversation List + Message View](https://www.cometchat.com/docs/ui-kit/ios/v6/conversation-message-view.md)
>
> `CometChatConversations` in a `UINavigationController`, pushing a chat screen

### One-to-One / Group Chat

A single chat window with no list. It opens a specific user's or group's chat directly — ideal for
support chat, direct messages, or notification-driven flows.

> [card] [Build One-to-One / Group Chat](https://www.cometchat.com/docs/ui-kit/ios/v6/one-to-one-chat.md)
>
> Header, message list and composer for one chat

### Tab-Based Chat

A `UITabBarController` with Chats, Calls, Users and Groups.

> [card] [Build Tab-Based Chat](https://www.cometchat.com/docs/ui-kit/ios/v6/tab-based-chat.md)
>
> Each tab hosts a CometChat view controller

***

## Make It Yours

Three routes, in increasing order of power.

**Configure** — properties, fluent setters and view slots:

```swift theme={null}
conversations.hideBackButton = false
conversations
    .set(trailView: { conversation in MyUnreadPill(for: conversation) })
    .set(addOptions: { conversation, _ in
        [CometChatConversationOption(id: "pin", title: "Pin") { conversation, _ in
            pin(conversation)
        }]
    })
```

**Replace the cell** — supply your own `UITableViewCell` subclass:

```swift theme={null}
conversations.listItemCellClass = MyConversationCell.self
```

> [!NOTE]
>
> A custom cell must clear its custom subviews in `prepareForReuse()`, or the wrong content appears on
> the next row during fast scrolling. The built-in cell does this.

**Subclass** — the override points are `open`:

```swift theme={null}
final class AddMembersViewController: CometChatConversations {
    override func setupStyle() {
        super.setupStyle()
        view.backgroundColor = UIColor.systemGroupedBackground
    }
}
```

`defaultSetup`, `setupStyle`, `showEmptyView`, `showErrorView`, `reloadData`, `configureMenu` and
`updateNavigationBarTitleWithCount` are all overridable.

See [Conversations](https://www.cometchat.com/docs/ui-kit/ios/v6/conversations.md) for the whole surface, and
[Theming](https://www.cometchat.com/docs/ui-kit/ios/v6/theming.md) for colours and typography.

***

## Next Steps

> [card] [Components Overview](https://www.cometchat.com/docs/ui-kit/ios/v6/components-overview.md)
>
> Browse all available UI Kit components

> [card] [Theming](https://www.cometchat.com/docs/ui-kit/ios/v6/theming.md)
>
> Customize colors, fonts, and styles

> [card] [Core Features](https://www.cometchat.com/docs/ui-kit/ios/v6/core-features.md)
>
> Chat features included out of the box

> [card] [Migrating from v5](https://www.cometchat.com/docs/ui-kit/ios/v6/migrating-from-v5.md)
>
> Move a CometChatUIKitSwift 5.x app to v6


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